问题描述
- 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;
}
}}
解决方案
已经找到方法
在upsteam 里加入参数ip_hash
时间: 2025-01-30 11:43:17