- 只需要在upstream的server后面添加一个weight即可代表权重。权重越高,分配请求的数量就越多。默认权重是1。
upstream tomcats{
server 192.168.1.101:8080 weight=2;
server 192.168.1.101:8081;
}
server {
listen 80;
server_name www.ttba.com;
#root html ;
#index index.html;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://tomcats;
index index.html index.htm;
}
}