nginx.conf

user  webuser webuser;
worker_processes  8;


events {
    use epoll;
    worker_connections  4096;
}
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"';



upstream parkingcust {
   ip_hash;
   server 192.168.73.50:1011;
   server 192.168.73.51:1011;
   server 192.168.73.52:1011;
}

upstream parkingadmin {
   ip_hash;
   server 192.168.73.50:1021;
   server 192.168.73.51:1021;
   server 192.168.73.52:1021;
}

upstream parkinglot {
   ip_hash;
   server 192.168.73.50:1031;
   server 192.168.73.51:1031;
   server 192.168.73.52:1031;
}
upstream parkingPlatform {
   ip_hash;
   server 192.168.73.50:1051;
   server 192.168.73.51:1051;
   server 192.168.73.52:1051;
}
upstream parkingcust1 {
   ip_hash;
   server 192.168.73.50:1012;
   server 192.168.73.51:1012;
   server 192.168.73.52:1012;
}
upstream parkingphone {
   ip_hash;
   server 192.168.73.50:1061;
   server 192.168.73.51:1061;
   server 192.168.73.52:1061;
}
upstream parkingcustwx {
   ip_hash; 
   server 192.168.73.51:11011;
}

    #access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    keepalive_timeout  65;

   server {
        listen       80;
        server_name  p.ichuxing.cc;
        

        index index_tel.jsp index.jsp index.html index.htm login.jsp *.css;


        location / {
            index index.html index.htm;
            proxy_pass http://192.168.73.50:1091/;
        }

        location /parkingcust/ {
            index index.html index.htm;
            proxy_pass http://parkingcust;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }        
         
            location /parkingadmin/ {
             index index.jsp index.html index.htm *.css;
             proxy_pass http://parkingadmin;
        }
       
        
        location /parkinglot/ {
             index  index_tel.jsp index.jsp index.html index.htm *.css;
             proxy_pass http://parkinglot;
        }
        location /parkingPlatform/ {
             index  index_tel.jsp index.jsp index.html index.htm *.css;
             proxy_pass http://parkingPlatform;
        }
       location /parkingcust1/ {
             index  index_tel.jsp index.jsp index.html index.htm *.css;
             proxy_pass http://parkingcust1;
        }
       location /parkingphone/{
             index  index_tel.jsp index.jsp index.html index.htm *.css;
             proxy_pass http://parkingphone;
       }
       location /parkingcustwx/{
             index  index_tel.jsp index.jps index.html index.htm *.css;
             proxy_pass http://parkingcustwx;
       }
                #location /nginx_status {
                #       stub_status on;
                #       access_log off;
                #}
      }
}

 

 

#user  nobody;
worker_processes  8;

#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;
    
     proxy_redirect          off; 
        proxy_set_header        Host $http_host; 
        #proxy_set_header        X-Real-IP $remote_addr; 
        proxy_set_header        X-Forwarded-For   $proxy_add_x_forwarded_for;
        client_max_body_size    10m; 
        client_body_buffer_size 128k; 
        proxy_connect_timeout   90; 
        proxy_send_timeout      90; 
        proxy_read_timeout      36000; 
        proxy_buffer_size       4k; 
        proxy_buffers           4 2m; 
        proxy_busy_buffers_size 3m; 
        proxy_temp_file_write_size 2m;
        server_names_hash_bucket_size 128; 


        #gzip on;
        #gzip_types text/css text/javascript application/x-javascript; 
        #sendfile        on;
        tcp_nopush     on;
        tcp_nodelay    on;
        client_body_timeout 30;
        #keepalive_timeout  60;
        client_header_buffer_size 8k;
        large_client_header_buffers 4 32k;    
        
    


    server {
        listen       80;
        server_name  192.168.73.106;
        index index_tel.jsp index.jsp index.html index.htm login.jsp *.css;
  
#       location /parkingcustwx/ {
#             index index_tel.jsp index.jsp index.html index.htm;
#             proxy_pass http://192.168.73.104:1011/parkingcustwx/;
#        }  
#     
#     
#       location /parkingadmin/ {
#             index index_tel.jsp index.jsp index.html index.htm;
#             proxy_pass http://192.168.73.104:1021/parkingadmin/;
#        }  
#     
#     
#       location /parkinglot/ {
#             index index_tel.jsp index.jsp index.html index.htm;
#             proxy_pass http://192.168.73.104:1031/parkinglot/;
#        }  

       location /centerumms/ {
             index index_tel.jsp index.jsp index.html index.htm;
             proxy_pass http://192.168.73.106:8882/centerumms/;
        }  
     }
           
}

 

 

你可能感兴趣的:(nginx,nginx.conf,upstream,nginx配置)