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 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
add comment

1 Answer

You should check Phusion Passenger (a.k.a. mod_rails): http://www.modrails.com/

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
1  
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
add comment

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.