IT运维笔记


nginx负载均衡测试

upstream down {
    ip_hash;
    server 192.168.1.12:53180 weight=2;
    server 192.168.1.13:53180 weight=3;
    server 192.168.1.11:80 weight=5;
}

server {
    listen       80;
    server_name  www.test.org;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/test.org;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/test.org/50x.html;
    }


    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    location /m/ {
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        #proxy_set_header X-Forwarded-For $proxy_addr_x_forwarded_for;
        proxy_pass   http://down/m/;
    }


}