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

In the process of deploying multiple EC2 instances running a Rails app over Unicorn. I currently have a "front end" server running nginx with multiple "Unicorn" upstream providers.

At night, I'd like to turn off a few unicorn servers and in the morning boot them up again (which I have working fine).

Should I also be removing/commenting out the upstream providers in my nginx conf and then doing a nginx config load? (To stop nginx from trying to send clients to my switched-off ec2 instances).

Is there a better way to handle this? (HAproxy perhaps?)

share|improve this question

I think one of the simplest ways to implement this, is to use LVS. With LVS you could create a virtual server to be the backend of your Nginx, possibly on the localhost of each Nginx itself. Then you just point the Nginx upstream to the LVS Virtual Server. The Unicorns are the backends of the LVS, defined as server-address.

That way it should be really easy to add/remove backends from the Virtual Server via some cronjob, because you can do these actiones via simple ipvsadm commands.

Of course it would also be possible to add/remove servers from the Nginx upstream definition via some scripts, but I would regard the LVS solution to be much easier to script and less likely to fail.

share|improve this answer
LVS seems overkill for what I'm trying to achieve. Cheers though. – Jamsi Feb 21 '13 at 1:11

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.