注册
登录
提问时间:2016/7/24 22:35:47
nginx.conf配置如下:
location / {
root html;
index index.html index.htm;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost;
}
upstream localhost {
ip_hash;
server 127.0.0.1:18777;
server 127.0.0.1:28777;
}
1楼(未知网友)

根据nginx 的wiki [1] ,
The key for the hash is the class-C network address of the client.

也就是ip_hash 里,根据的是client 的c 段,也就是 10.5.110.x ,都看做同一个client ,也就分配到同一个server 了。

-----
[1]: http://wiki.nginx.org/HttpUpstreamModule#ip_hash
立即注册站大爷用户,免费试用全部产品
立即注册站大爷用户,免费试用全部产品