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

I am using ngnix to route traffic to proper application servers based on a cookie value. So one user always lands in a particular uptstream server.

Now I have multiple such uptsream servers. I want to send 503 for a upstream server when I am taking it down for maintenance purpose. What is the simplest way to do it?

If the application server is crashed we should get normal "could not connect to backend" error. So, I should get 503 for a upstream only when I am taking it down intentionally.

share|improve this question
So you want users to fail to get a response instead of failing over to a working application server? Can you clarify what you config looks like now for the backends? – Shane Madden Jan 19 '12 at 17:01

I'm assuming you want to send a 503 page rather than a 503 status code. If the former, you could add an error_page line for a particular http, server or location config block:

location / {
    proxy_intercept_errors on; # this line may not be needed
    error_page 503 /var/www/errors/status-503.html
    # rest of your config here
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.