upstream nginx{
server 192.168.1.10:88 weight=3;
server 192.168.1.11:80 weight=10;
ip_hash;
}
server{
listen 80;
server_name nginx.test.wdlinux.cn;
location / {
index index.html;
root /usr/html;
proxy_pass http://nginx;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
# hash $cookie_jsessionid;
hash $remote_addr consistent;
server 192.168.142.128:8080 weight=3;
server 192.168.142.129:80 weight=10;
# hash $cookie_jsessionid;
# server 192.168.142.130:80;
# ip_hash;
# hash_again 1;
# consistent_hash $remote_addr:可以根据客户端ip映射
# consistent_hash $request_uri: 根据客户端请求的uri映射
# consistent_hash $args:根据客户端携带的参数进行映射