Nginx负载均衡

2017-02-23  本文已影响14人  Kosh

在http下server前加上

upstream  mcs  {
        server   10.0.0.10:8080  weight=1 max_fails=3 fail_timeout=30s;
        server   10.0.0.13:8080  weight=1 max_fails=3 fail_timeout=30s;
    }

修改

server {
        listen       80;
        server_name  mcs;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            proxy_pass        http://mcs;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
上一篇 下一篇

猜你喜欢

热点阅读