Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Does nginx go to the next host in upstream block, if previous host not available or doesn't exist?

upstream cache_cluster {;     //something on this port;   //memcached instance on this port

location  {
 //..some code here
 memcached_pass cache_cluster;
 error_page 404 502 504 =  @something;
share|improve this question
up vote 2 down vote accepted

upstream only provide a list of servers, and some kind of weight. To tell Nginx what to do if one of the servers fail, you need to control this with memcached_next_upstream.

From the Nginx-documentation:


syntax: memcached_next_upstream [ error | timeout | invalid_response | not_found | off ]

default: error timeout

context: http, server, location

Which failure conditions should cause the request to be forwarded to another upstream server? Applies only when the value in memcached_pass is an upstream with two or more servers.

As stated in the documentation, the default behaviour is error / timeout, which should be sufficient in most cases.

share|improve this answer

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.