nginx入门配置

 

user  www www;
worker_processes  4;

error_log  logs/error.log;

#pid        logs/nginx.pid;


events {
    worker_connections  56636;
}


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  65;

    #gzip  on;
    
    upstream test_d{
        server 10.86.48.22:65531;
    }
    upstream abcd_d{
        server 10.86.48.22:8091;
    }

    server {
        listen       8089;
        server_name  test.adu.com;

        location / {
            proxy_pass http://test_d;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }
    server {
        listen       8089;
        server_name  abcd.adu.com;

        location / {
            proxy_pass http://abcd_d;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }

}

 

posted @ 2016-11-21 15:38  waterystone  阅读(371)  评论(0编辑  收藏  举报