nginx 여러 개의 80 포트 전송

11901 단어 nginx
#user  nobody;
worker_processes  2;
worker_rlimit_nofile 50000;
worker_cpu_affinity 00000001  10000000;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;


#pid        logs/nginx.pid;


#       257134    ulimit -u
events {
    worker_connections  50000;
}




http {
    include       mime.types;
    default_type  application/octet-stream;
    server_names_hash_bucket_size 64;
    #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;
    gzip_min_length 1k;
    #16     
    gzip_buffers 16 64k;
    #gzip    
    gzip_http_version 1.1;
    gzip_comp_level 2;#gzip   ,1              1~9
    gzip_types text/plain application/x-javascript text/css text/javascript application/javascript;
    gzip_vary on;
    #   1~6 IE
    gzip_disable “MSIE [1-6]\.”;


    #    
     upstream bakend {
         ip_hash;
         server 127.0.0.1:9080;
         server 127.0.0.1:9180;
    }

   #www
    server {
        listen       8090;
        server_name  127.0.0.1;
        location / {
            root   html;
            index  index.html index.htm;
        }



        error_page   404 500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }


    }




  #  www
    server {
        listen       80;
        server_name  www.****.com ;
        location / {
          proxy_pass   http://127.0.0.1:8090;
      proxy_set_header   Host    $host;
          proxy_set_header   Remote_Addr    $remote_addr;
          proxy_set_header   X-Real-IP    $remote_addr;
          proxy_set_header   X-Forwarded-For    $proxy_add_x_forwarded_for;
        }


    error_page   404 500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

  #  APP
    server {
        listen       80;
        server_name  lgs.****.com ;
        location / {
          proxy_pass  http://127.0.0.1:9880;
      proxy_set_header   Host    $host;
          proxy_set_header   Remote_Addr    $remote_addr;
          proxy_set_header   X-Real-IP    $remote_addr;
          proxy_set_header   X-Forwarded-For    $proxy_add_x_forwarded_for;
        }


    error_page   404 500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
  #  APP
    server {
        listen       80;
        server_name  emall.****.com;
        location / {
           #proxy_pass   http://127.0.0.1:9080;
      proxy_pass http://bakend/;
          proxy_set_header   Host    $host;
          proxy_set_header   Remote_Addr    $remote_addr;
          proxy_set_header   X-Real-IP    $remote_addr;
          proxy_set_header   X-Forwarded-For    $proxy_add_x_forwarded_for;
        }


    error_page   404 500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

  #    
   server {
        listen       80;
        server_name  managelgs.****.com;
        location / {
          proxy_pass   http://127.0.0.1:9780;
      proxy_set_header   Host    $host;
          proxy_set_header   Remote_Addr    $remote_addr;
          proxy_set_header   X-Real-IP    $remote_addr;
          proxy_set_header   X-Forwarded-For    $proxy_add_x_forwarded_for;
        }


    error_page   404 500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }


   #    
    server {
        listen       80;
        server_name  manage.****.com;
        location / {
           proxy_pass   http://127.0.0.1:9280;
       proxy_set_header   Host    $host;
           proxy_set_header   Remote_Addr    $remote_addr;
           proxy_set_header   X-Real-IP    $remote_addr;
           proxy_set_header   X-Forwarded-For    $proxy_add_x_forwarded_for;
        }


    error_page   404 500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

   #        
    server {
        listen       80;
        server_name  images.****.com;
        location / {
           proxy_pass   http://127.0.0.1:1314;
          proxy_max_temp_file_size 0;
          expires 1h;

         }


    error_page   404 500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;


    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}




    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;


    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;


    #    ssl_session_timeout  5m;


    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;


    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


}

좋은 웹페이지 즐겨찾기