在需要被负载均衡的域名配置信息中添加
server {
server_name "docker.mqphp.com";
listen 80;
location / {
proxy_pass http://tomcat_back;
proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
在nginx.conf中进行设置
#gzip on;
upstream test{
#ip_hash;
server localhost:8280;
server localhost:8180;
server zz.longqine.com;
}
upstream tomcat_back {
server docker.mqphp.com:8080 weight=1;
}