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

I'm having trouble configuring nginx.

I'm using nignx as a reverse proxy. I want to send my all requests to my first server. If the first server is down, I want to send requests to second server.

In short, how can I have a failover solution without load balancing?

share|improve this question
up vote 9 down vote accepted

What you want is an active+passive setup. Here's an example nginx conf snippet to get you going:

upstream backend {
    server fail_timeout=5s max_fails=3;
    server backup;

server {
    listen 80;

    location / {
        proxy_pass http://backend;

So, 'normally', all requests will go to host If we get three failures to that box, then will take over.

share|improve this answer
thank you, it works – Serhat Feb 19 '13 at 14:41

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.