ubuntu如何用nginx绑定域名
时间:2023-05-12 04:24
ubuntu用nginx绑定域名的示例: 1.准备configuration,将以下的配置文件内容放入/etc/nginx/sites-available/node-app文件中,内容: upstream node_server { server 127.0.0.1:3000 fail_timeout=0; server 127.0.0.1:5000 fail_timeout=0; server 127.0.0.1:5001 fail_timeout=0; } server { listen 80; listen [::]:80 default_server; index index.html index.htm; server_name www.abc.com; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_redirect off; proxy_buffering off; proxy_pass http://node_server; } location /public/ { root /opt/app; } } 2.在终端运行以下命令即可: sudo rm /etc/nginx/sites-enabled/default sudo ln -s /etc/nginx/sites-available/node-app /etc/nginx/sites-enabled/node-app sudo /etc/init.d/nginx restart 以上就是ubuntu如何用nginx绑定域名的详细内容,更多请关注Gxl网其它相关文章!