Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm having trouble with configuring nginx.

I'm using nignx for reverse porxy. I just want to send my all requests to my first server. But if the first server is down, I want to send requests to second one.

Shortly I want to failover solution without load balancing.

Sorry, I'm new at nginx.

share|improve this question

1 Answer 1

up vote 3 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;
    server_name whatevs.com;

    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.