The configuration nginx

 

  1) a reverse proxy (Reverse Proxy) mode refers to the proxy server to accept connection requests on the internet, and then forward the request to the server on the internal network, and the results returned from the server to the client requesting a connection to the internet end, this time on the performance of the external proxy server is a server

# / Etc / Nginx / nginx.conf 

HTTP { 
    // when accessing the server through port face.danoolive.com:80
     // the request is forwarded to the 127.0.0.1:9992 
    Server { 
        the listen 80 ; 
        server_name face.danoolive. COM; 
        // handled by the access path forward ... 
        LOCATION / { 
             // not necessarily within the network 127.0.0.1, or may be some other ports such as a server ... 
            proxy_pass HTTP: // 127.0. 0.1: 9992; 
        } 
    } 

    // when the server is accessed by the port res.danoolive.com:80
     // the request is forwarded to the 127.0.0.1:9991 
    server { 
        the listen 80 ;
        server_name res.danoolive.com; 
        location / { 
            proxy_pass http://127.0.0.1:9991;
        }
    }

}

   Example:

server
    {
        listen 80;
        server_name rap.startbaby.xyz ;
        location / {
            #反向代理
            proxy_pass http://0.0.0.0:3333;
            add_header Access-Control-Allow-Origin *;
        }

        access_log  /home/wwwlogs/rap.startbaby.xyz.log;
    }

 

Guess you like

Origin www.cnblogs.com/xingxia/p/nginx_configs.html