Nginx address jump and Domain name resolution NGINX configuration Multi-domain nginx configuration domain name access nginx bind multiple domains

Source: Internet
Author: User
Reprint please indicate source: http://blog.csdn.net/loongshawn/article/details/51413031

Related articles:

    • "Nginx Address Jump"

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.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.