So, how do I set up a Rails app so it doesn’t live at web server root, and can share the web server with other rails apps?

I feel like answering this question should be a simple ‘find it in the docs’ or even on an FAQ, but instead it’s turned into a Google research project of conflicting advice.

Can anyone just point me to what I need to know?


5 thoughts on “rails?

  1. You have a couple of options:
    1) You could use Apache/FCGI
    The downsides are that you’d have to restart Apache whenever you change anything on any of your rails sites
    2) You can use Apache with mod_proxy to serve a mongrel server. Mongrel has a –prefix=/path switch to tell rails that it’s not at root
    The downside is that Mongrel can’t thread rails, so you can only serve 1 request at a time.
    3) You can use Apache with mod_proxy to serve lighttpd with fcgi running your rails app.
    The downside is that it’s not always terribly simple to get lighttpd/fastcgi working.
    4) You can use Apache >= 2.2 with mod_proxy_balancer to serve a mongrel cluster.
    The downside is that I haven’t seen 2.2 available in any major package mgmt system.
    5) You can use Apache Nginx proxying a mongrel cluster.

    If it’s any help, I use options 2, 3 and 5 (although 3 only on a low traffic service and 5 on my development server).

  2. Er, that screwed up my comment. I guess I need to escape my characters

    5) You can use Apache < 2.2 with mod_proxy and pen or balance proxying a mongrel cluster
    The downside is that you now have 3 servers running for one application.
    6) If you’re not married to Apache, you can use Nginx proxying a mongrel cluster.

  3. Is it petulant of me to find it weird and annoying that I need to deal with a non-apache web server (and/or a non-standard Apache version), in one configuration or another, just to run two rails apps on the same web server at different web paths?

    I’m trying to be less petulant lately. But this seems like a ridiculous dependency to me. I don’t understand why it would be required. But maybe it’ll all become clear when I learn more about what’s going on, maybe this somehow is the unfortunate but necessary result of a perfectly good architecture design in rails, and not the weird lack of feature it appears to be.

  4. We’re using Apache/FCGI, Ross’s #1, in production and it has been working quite well for us. No need to use non-Apache web servers or other funky setups.

  5. I haven’t used FCGI ever, and also am just barely getting into Rails. Will FCGI support Rails session management without problems?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s