arrowbest 2016-03-08 15:27 采纳率: 0%
浏览 1467
已采纳

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 2016-03-08 15:31
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料