[英]How to connect my domain to my node app with nginx
I bought ubuntu server in digitalocean. 我在Digitalocean购买了ubuntu服务器。
I am connecting my server IP through ssh on my terminal and i create a small node app and after starting the app, I can able to see my app running on my http://myipaddress:nodeport 我通过终端上的ssh连接服务器IP,并创建了一个小型节点应用程序,启动该应用程序后,我可以看到我的应用程序在我的http:// myipaddress:nodeport上运行
How i can i connect my domain to this? 我如何将我的域与此连接?
I bought free domain from freenom for testing purpose. 我从freenom购买了免费域以进行测试。
By following some tutorials i make a /etc/nginx/sites-available folder into my server and create a file called default and write code like this 通过遵循一些教程,我将一个/ etc / nginx / sites-available文件夹放入我的服务器,并创建一个名为default的文件并编写如下代码
server {
listen 80;
server_name sameer.tk; // i bought this domain from freenom
location / {
proxy_pass http://my_private_ip:3004 //with nodeport
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
But if i hit sameer.tk after the setup its not working, i even restart my nginx. 但是,如果在安装程序不起作用后我击中了sameer.tk,我什至会重启我的Nginx。
You no need any nginx for node server. 您不需要任何nginx作为节点服务器。 You may run node server as 80 port and open 80 port in network security group.
您可以将节点服务器作为80端口运行,并在网络安全组中打开80端口。 After that, you should point domain to your instance public ip address in your domain management panel.
之后,您应该在域管理面板中将域指向实例的公共IP地址。
Ref: 参考:
https://www.digitalocean.com/community/tutorials/how-to-point-to-digitalocean-nameservers-from-common-domain-registrars https://www.digitalocean.com/community/tutorials/how-to-point-to-digitalocean-nameservers-from-common-domain-registrars
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.