How to bind domain name with nginx in ubuntu

PHPz
Release: 2023-05-11 18:22:19
forward
1031 people have browsed it

Example of ubuntu using nginx to bind a domain name:

1. Prepare the configuration and put the following configuration file contents into the /etc/nginx/sites-available/node-app file, content:

<p><br></p><p>upstream node_server {</p><p>server 127.0.0.1:3000 fail_timeout=0;</p><p>server 127.0.0.1:5000 fail_timeout=0;</p><p>server 127.0.0.1:5001 fail_timeout=0;</p><p>}</p><p><br></p><p>server {</p><p>listen 80;</p><p>listen [::]:80 default_server;</p><p><br></p><p>index index.html index.htm;</p><p><br></p><p>server_name www.abc.com;</p><p><br></p><p>location / {</p><p>proxy_set_header Host $host;</p><p>proxy_set_header X-Real-IP $remote_addr;</p><p>proxy_redirect off;</p><p>proxy_buffering off;</p><p>proxy_pass http://node_server;</p><p>}</p><p><br></p><p>location /public/ {</p><p>root /opt/app;</p><p>}</p><p>}</p><p><br></p>
Copy after login

2. Run the following command in the terminal:

<p>sudo rm /etc/nginx/sites-enabled/default</p><p>sudo ln -s /etc/nginx/sites-available/node-app /etc/nginx/sites-enabled/node-app</p><p>sudo /etc/init.d/nginx restart</p><p><br></p>
Copy after login

The above is the detailed content of How to bind domain name with nginx in ubuntu. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!