配置实例代码:
...
upstream backend #配置后端服务器组
{
server 192.168.110.10;
server 192.168.110.11;
server 192.168.110.12; #默认权重weight为1
}
server
{
listem 80;
index index.html index.htm;
location / {
proxy_pass http://backend;
...
}
...
}
backend服务器组中所有服务器的优先级全部配置为默认(weight=1),这样服务器会按照一般轮询策略依次接收请求任务。