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 have NGiNX setup, and would like to be able to run sites I create in Ruby.

However my server is pretty fail, only like 250mb memory, probably less, so instead of having to run each Ruby site with the Thin server I want to run the Ruby sites only when they are accessed, like the way PHP works with the PHP-FPM server.

How does one go about this with NGiNX and Ruby?

share|improve this question

You should check Phusion Passenger (a.k.a. mod_rails):

It supports nginx, on-demand spawning of new processes, and many other extras.

share|improve this answer
But doesn't that run the app in the background after the first request? that's something I'm trying to avoid. – FooManChu Sep 11 '11 at 22:29
Ah, I thought that PHP-FPM also runs at least one instance of the application persistently. And to answer your question: yes, Passenger runs at least one instance of your application all the time, in order to speed up serving of requests. I'm pretty sure that there's no available solution that will run the application upon request and shut it down after the request is served. – Vladimir Blaskov Sep 11 '11 at 22:34
PHP-FPM runs in the background as a server, and whenever a PHP file is accessed via NGiNX, NGiNX tells PHP-FPM to run that PHP file and return the output. I'm looking for something similar for Ruby stuff. – FooManChu Sep 11 '11 at 22:51
Well, yes, Passenger does that except that it doesn't run in background by itself as it is part of nginx. There's also a stand-alone version (which in fact is based on nginx again), but if you're low on resources, it's better to run it only once, so compile it into nginx and give it a try. That's currently considered to be the way to go in the Ruby community. – Vladimir Blaskov Sep 12 '11 at 5:42

You can do things the way you want, but remember that firing up a Rails process for every page hit is going to kill your server's performance. Rails is a beast, and it will take many seconds to load it each hit.

Passenger used to be the way I ran Rails, but then I found Unicorn, which for me works much better, but I deal in small volume sites (just far too many of them...)

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.