Home >Backend Development >PHP Tutorial >nginx address jump and domain name resolution nginx configure multiple domain names nginx configure domain name access nginx binds multiple domains
Please indicate the source when reprinting: http://blog.csdn.net/loongshawn/article/details/51413031
Related articles:
1. Background
Sometimes A server will deploy both nginx and other web services. At this time, nginx occupies port 80 of the server, and the web service uses non-port 80.
It looks like this website: http://104.69.205.247:8086, its port is 8086, but if this website needs to give it a whole domain name, you will run into trouble at this time, because the domain name can only resolve the 80 of the server The port address is 104.69.205.247. At this time, we need to use nginx to create a jump service so that when accessing http://104.69.205.247, the service will jump to the service on port 8086.
2. To achieve
Enter the server nginx installation path and enter the conf folder:
Open the nginx.conf file and execute the command vi nginx.conf:
<code> server { listen <span>80</span>; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; }</code>
Modify the content of this part of the above file as follows:
<code> server { listen <span>80</span>; # server_name localhost; server_name http:<span>//104.69.205.247;</span> #charset koi8-r; #access_log logs/host.access.log main; location / { #root html; #index index.html index.htm; proxy_set_header Host $host; proxy_set_header X-Real-Ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http:<span>//104.69.205.247:8086;</span> } </code>
Save the modified file, enter the sbin directory, and restart the nginx service:
<code>./nginx -s reload</code>
The restart is successful, as shown in the picture below. There is a doubt in the picture below, which can be ignored:
3. Result
3.1. No jump
Access through port 8086
3.2. Do jump
Access through port 80
4. Domain name resolution
By performing jump service on port 80, subsequent access The website only needs to enter the IP address, no port number is required, and domain name resolution only needs to be done through the A record.
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });The above introduces nginx address jump and domain name resolution, including nginx and domain name resolution. I hope it will be helpful to friends who are interested in PHP tutorials.