nginx 配置反向代理 nginx配置多个IP地址


#user  nobody;
worker_processes  2;


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;


server {  
       listen       80;  
       server_name   zxbadmin.com.cn;  
  server_name_in_redirect off;  
  proxy_set_header Host $host:$server_port;  
       proxy_set_header X-Real-IP $remote_addr;  
       proxy_set_header REMOTE-HOST $remote_addr;  
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
  location / {  
proxy_pass http://127.0.0.1:8080/;  
       }  
    }  

server {  
       listen       80;  
       server_name   aqadmin.com.cn;  
  server_name_in_redirect off;  
  proxy_set_header Host $host:$server_port;  
       proxy_set_header X-Real-IP $remote_addr;  
       proxy_set_header REMOTE-HOST $remote_addr;  
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
  location / {  
proxy_pass http://127.0.0.1:8081/;  
       }  
    }  

server {  
       listen       80;  
       server_name   1hdzadmin.com.cn;  
  server_name_in_redirect off;  
  proxy_set_header Host $host:$server_port;  
       proxy_set_header X-Real-IP $remote_addr;  
       proxy_set_header REMOTE-HOST $remote_addr;  
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
  location / {  
proxy_pass http://127.0.0.1:8082/;  
       }  
    }  


server {  
       listen       80;  
       server_name  wmhadmin.com.cn;  
  server_name_in_redirect off;  
  proxy_set_header Host $host:$server_port;  
       proxy_set_header X-Real-IP $remote_addr;  
       proxy_set_header REMOTE-HOST $remote_addr;  
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
  location / {  
proxy_pass http://127.0.0.1:8083/;  
       }  
    }  

server {  
       listen       80;  
       server_name   hsadmin.com.cn;  
  server_name_in_redirect off;  
  proxy_set_header Host $host:$server_port;  
       proxy_set_header X-Real-IP $remote_addr;  
       proxy_set_header REMOTE-HOST $remote_addr;  
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
  location / {  
proxy_pass http://127.0.0.1:8084/;  
       }  
    }  

server {  
       listen       80;  
       server_name   xyydadmin.com.cn;  
  server_name_in_redirect off;  
  proxy_set_header Host $host:$server_port;  
       proxy_set_header X-Real-IP $remote_addr;  
       proxy_set_header REMOTE-HOST $remote_addr;  
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
  location / {  
proxy_pass http://127.0.0.1:8085/;  
       }  
    }  


server {  
       listen       80;  
       server_name  sladmin.com.cn;  
  server_name_in_redirect off;  
  proxy_set_header Host $host:$server_port;  
       proxy_set_header X-Real-IP $remote_addr;  
       proxy_set_header REMOTE-HOST $remote_addr;  
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
  location / {  
proxy_pass http://127.0.0.1:8086/;  
       }  
    } 






    # 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 ssl;
    #    server_name  localhost;


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


    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;


    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;


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


}
阅读更多

没有更多推荐了,返回首页