Reprint please indicate source: http://blog.csdn.net/loongshawn/article/details/51413031
Related articles:
1. Background
Sometimes a server deploys both Nginx and other Web services, which in turn consumes 80 of the server's port, and the Web service uses a non-80 port.
Like this website: http://104.69.205.247:8086, its port is 8086, but if this site needs to give him a whole domain name, this time encountered trouble, because the domain name can only parse the server's 80 port address is 104.69.205.247. At this time, we need to use Nginx to do a jump service, so that when access to http://104.69.205.247, the service will jump to 8086 port services.
2. Realize
Enter the server Nginx installation path and enter the Conf folder:
Open nginx.conf file, execute command VI nginx.conf:
server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; }
Modify the contents of this section of the above documents as follows:
server { listen 80; # server_name localhost; server_name http://104.69.205.247; #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://104.69.205.247:8086; }
Save the modified file, enter the Sbin directory, restart the Nginx service:
./nginx -s reload
Restart successful, as shown in the hint that there is a doubt point, can be ignored:
3. Results
3.1, do not jump
Access via 8086 port
3.2, do jump
Access via 80 port
4. Domain Name resolution
Through the 80 port to do the jump service, follow-up access to the site only need to enter the IP address, without the port number, domain name resolution only through a record to do the analysis.
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the Nginx address jump and domain name analysis, including Nginx, domain name resolution content, I hope that the PHP tutorial interested friends have helped.