当81站点在20s内.失败一次后,则切换到82站点,20s内不再转发到81站点
1 配置UpStream
upstream servers { server localhost:81 weight=8 max_fails=1 fail_timeout=20s; server localhost:82 weight=2 backup; }
2 配置Server
server { listen 80; server_name localhost; location / { proxy_pass http://servers; root html; index index.html index.htm; proxy_connect_timeout 1; proxy_read_timeout 1; proxy_send_timeout 1; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; }