nginx.conf

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
    
    ################################
  upstream default-tomcat-service-clsip-01-8080 {
        # Load balance algorithm; empty for round robin, which is the default
        least_conn;
        server 172.30.10.5:8080 max_fails=0 fail_timeout=0;
        server 172.30.28.2:8080 max_fails=0 fail_timeout=0;
    }
    upstream default-tomcat-service-clsip-02-8080 {
        # Load balance algorithm; empty for round robin, which is the default
        least_conn;
        server 172.30.10.5:8080 max_fails=0 fail_timeout=0;
        server 172.30.28.2:8080 max_fails=0 fail_timeout=0;
    }
    upstream default-tomcat-service-clsip-8080 {
        # Load balance algorithm; empty for round robin, which is the default
        least_conn;
        server 172.30.10.5:8080 max_fails=0 fail_timeout=0;
        server 172.30.28.2:8080 max_fails=0 fail_timeout=0;
    }
    upstream default-tomcat-service-test01-8080 {
        # Load balance algorithm; empty for round robin, which is the default
        least_conn;
        server 172.30.10.5:8080 max_fails=0 fail_timeout=0;
        server 172.30.28.2:8080 max_fails=0 fail_timeout=0;
    }
    upstream default-tomcat-service-test02-8080 {
        # Load balance algorithm; empty for round robin, which is the default
        least_conn;
        server 172.30.10.5:8080 max_fails=0 fail_timeout=0;
        server 172.30.28.2:8080 max_fails=0 fail_timeout=0;
    }
    upstream default-tomcat-service-test022-8403 {
        # Load balance algorithm; empty for round robin, which is the default
        least_conn;
        server 127.0.0.1:8181 max_fails=0 fail_timeout=0;
    }
    upstream upstream-default-backend {
        # Load balance algorithm; empty for round robin, which is the default
        least_conn;
        server 172.30.92.3:8080 max_fails=0 fail_timeout=0;
    }

    #######################################
    
    server {
        server_name gcp33.boco.com;
        listen 8765;
        listen [::]:8765;
        set $proxy_upstream_name "-";
        location /gcp11 {
           
            proxy_pass http://default-tomcat-service-clsip-8080;
        }
        location / {
   
            proxy_pass http://upstream-default-backend;
        }

    }

    server {
        server_name gcp44.boco.com;
        listen 8764;
        listen [::]:8764;
        set $proxy_upstream_name "-";
        location /gcp33 {
        
            proxy_pass http://default-tomcat-service-clsip-02-8080;
        }
        location /gcp22 {
            proxy_pass http://default-tomcat-service-clsip-01-8080;
        }
        location / {
           proxy_pass http://upstream-default-backend;
        }

    }
    
    
    
     server {
        server_name gcp2.boco.com;
        listen 8765;
        listen [::]:8765;
        set $proxy_upstream_name "-";
        location /gcp222 {
           
            proxy_pass http://default-tomcat-service-test022-8403;
        }
        location /gcp22 {
            
            proxy_pass http://default-tomcat-service-test02-8080;
        }
        location /gcp2 {
           
            proxy_pass http://default-tomcat-service-test01-8080;
        }
        location / {
           

            proxy_pass             http://upstream-default-backend;
        }

    }
######################################
}
原文地址:https://www.cnblogs.com/guoziyi/p/7458173.html