Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

All of the examples I've seen of using upstream (for load balancing) in nginx look like this:

upstream  backend  {
  server          max_fails=3  fail_timeout=30s;
  server          max_fails=3  fail_timeout=30s;
  server          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?

share|improve this question
up vote 3 down vote accepted

Specify proxy_upstream_fail_timeout and proxy_upstream_max_fails in your server {} config

For more info

share|improve this answer
Thanks. Those are marked as deprecated, is there any reason why that is? – John Smith May 22 '11 at 17:25
Hmm not sure, didn't realize they were depreciated (Posted the links from memory) but I'm running NGINX 1.0.1 and those directives still work, there may be a performance benefit from using the directives in an upstream server specifier (proxy_upstream_* relates to using the proxy mod, upstream {} flags apply to the upstream module. I'll do a bit of research (If there is a difference it would be beneficial to my own applications) and get back to you – Smudge May 22 '11 at 17:34
Will proxy_upstream_* make Nginx send the request to one of the other upstream servers on error? Intuitively I don't think so. – i.amniels May 23 '11 at 18:22
They're marked as deprecated because you should set them on the server directive now – Dan Esparza Aug 28 '15 at 17:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.