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

nginx address jump and domain name resolution nginx configure multiple domain names nginx configure domain name access nginx binds multiple domains

WBOY
WBOYOriginal
2016-07-29 08:49:171696browse

Please indicate the source when reprinting: http://blog.csdn.net/loongshawn/article/details/51413031

Related articles:

  • "nginx Address Jump"

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:

nginx域名配置,nginx 域名跳转,nginx 域名重定向,nginx 域名,nginx域名转发,nginx 多域名,nginx绑定域名,nginx 泛域名,nginx 二级域名,nginx配置多个域名,nginx 多个域名,nginx二级域名配置,nginx 配置多域名,nginx 配置域名访问,nginx 绑定多个域

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:

nginx域名配置,nginx 域名跳转,nginx 域名重定向,nginx 域名,nginx域名转发,nginx 多域名,nginx绑定域名,nginx 泛域名,nginx 二级域名,nginx配置多个域名,nginx 多个域名,nginx二级域名配置,nginx 配置多域名,nginx 配置域名访问,nginx 绑定多个域

3. Result

3.1. No jump

Access through port 8086

nginx域名配置,nginx 域名跳转,nginx 域名重定向,nginx 域名,nginx域名转发,nginx 多域名,nginx绑定域名,nginx 泛域名,nginx 二级域名,nginx配置多个域名,nginx 多个域名,nginx二级域名配置,nginx 配置多域名,nginx 配置域名访问,nginx 绑定多个域

3.2. Do jump

Access through port 80

nginx域名配置,nginx 域名跳转,nginx 域名重定向,nginx 域名,nginx域名转发,nginx 多域名,nginx绑定域名,nginx 泛域名,nginx 二级域名,nginx配置多个域名,nginx 多个域名,nginx二级域名配置,nginx 配置多域名,nginx 配置域名访问,nginx 绑定多个域

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.

nginx域名配置,nginx 域名跳转,nginx 域名重定向,nginx 域名,nginx域名转发,nginx 多域名,nginx绑定域名,nginx 泛域名,nginx 二级域名,nginx配置多个域名,nginx 多个域名,nginx二级域名配置,nginx 配置多域名,nginx 配置域名访问,nginx 绑定多个域

').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.

Statement:
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