在http代码块中增加以下配置:
upstream tomcat_pool {
server 192.168.253.131:8080 weight=4;
server 192.168.253.131:8081 weight=1;
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://tomcat_pool;
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-For $remote_addr;
root html;
index index.html index.htm;
}