Take the 2-minute tour ×
Server Fault is a question and answer site for professional 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.

Regards, Serhat

share|improve this question

1 Answer 1

up vote 1 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 1.2.3.4:80 fail_timeout=5s max_fails=3;
    server 4.5.6.7:80 backup;
}

server {
    listen 80;
    server_name whatevs.com;

    location / {
        proxy_pass http://backend;
    }
}

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

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

Your Answer

 
discard

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.