Nginx 负载均衡配置

 现有三台服务器

 10.160.51.16

10.160.51.54

10.160.51.55

16配置nginx , 请求转发到其余两台

修改默认配置如下:

cd /etc/nginx/conf.d/

vim default.conf

ip_hash 用于固定IP请求,若项目中有单点登录,或用到session,配置此字段,可防止session覆盖
 
其余两台服务器若为 tomcat ,则需注意 server.xml 中,host 配 localhost 还是域名。
原文地址:https://www.cnblogs.com/remember-forget/p/12102328.html