1.修改nginx.conf配置文件
upstream nginx {
#添加如下配置
session_sticky cookie=uid fallback=on path=/ mode=insert option=indirect
;
server 192.168.2.140:8080;
server 192.168.2.136:8080;
check interval=3000 rise=2 fall=5 timeout=1000 type=http;
check_http_send "HEAD / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
location / {
#添加如下配置
session_sticky_hide_cookie upstream=nginx;
proxy_pass http://nginx;
auth_basic off;
auth_basic_user_file /var/user;
root html;
index index.html index.htm;
}
2.重新启动nginx
3.参考http://tengine.taobao.org/document_cn/http_upstream_session_sticky_cn.html
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。