2 arrowbest arrowbest 于 2016.03.08 23:27 提问

nginx负载均衡 求组在线等

负载均衡配置后,可以访问前台页面,但是输入用户名密码后闪一下就没了。
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/nginx/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;
# Load config files from the /etc/nginx/conf.d directory
# The default server is in conf.d/default.conf
# include /etc/nginx/conf.d/*.conf;
 upstream tomcats{
    server 192.168.42.128:8080;
    server 192.168.42.129:8080;
     }

server
{
listen 80;
server_name 192.168.42.130;
location / {
proxy_pass http://tomcats;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

}

1个回答

arrowbest
arrowbest   2016.03.08 23:31
已采纳

已经找到方法
在upsteam 里加入参数ip_hash

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!