关于n:102nginx配置集群负载均衡

29次阅读

共计 473 个字符,预计需要花费 2 分钟才能阅读完成。

vi nginx.conf
在 #gzip on; 之后增加:

         upstream org.tonny.balance {        
                   server 127.0.0.1:8081 weight=1;      
                   server 127.0.0.1:8082 weight=1;      
         }   

在 server 节点下:

location / {        
            root   html;
            index  index.html index.htm;        
            proxy_pass http://org.tonny.balance     
        }     
location / {
                proxy_pass http://127.0.0.1:81;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto https;
    proxy_http_version 1.1;
    # for websocket 
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
        }

正文完
 0