All of the examples I've seen of using upstream (for load balancing) in nginx look like this:
upstream backend {
server backend1.example.com:8080 max_fails=3 fail_timeout=30s;
server backend2.example.com:8080 max_fails=3 fail_timeout=30s;
server backend3.example.com:8080 max_fails=3 fail_timeout=30s;
}
It seems repetitive to re-set max_fails and fail_timeout for each backend, when typically they are always the same. Is it possible to set max_fails and fail_timeout for all of the backend servers at once?
Best Answer
Specify
proxy_upstream_fail_timeout
andproxy_upstream_max_fails
in your server {} configSee
http://wiki.nginx.org/HttpProxyModule#proxy_upstream_fail_timeout
http://wiki.nginx.org/HttpProxyModule#proxy_upstream_max_fails
For more info