Topic: Multiple Rails applications on Apache


My company is working to set up a new web server that is going to serve our new website. We have choosen to use RadiantCMS for the public site, and I have managed to set up Apache and Mongrel to run this applications, and its working as expected. I also want to run other Rails application(s) on the same server, and here is where I got into trouble. What I want is to be able to access the two different applications like this:

where the first URL points to out public website, and the second to our "internal" webapplication.

I have been playing with VirtualHost and made it work but only one applications at time. I guess I could have controlled this with Rails routes, but this is two separate applications, and I want to keep them separate.

Does anybody out there know what I should do to make this work?


Re: Multiple Rails applications on Apache


Our production server works like this:
I have many mongrels. For each Rails application one (currently).
Each mongrel listens on a specific port(300x) only on so they
can't be accessed directly from the Internet.

For each mongrel, Apache has a virtual server. The virtual servers have a very minimalistic config:
They have a server name, and forward all requests to the corresponding mongrel using mod_proxy.

hope this helps

My homepage:
Working at:
My blog: soaked and soaped

Re: Multiple Rails applications on Apache

I had apache and fastcgi serving about 4 apps, I did it by symlinking to the public folder, but it really sucked.  Rails 1.2 has problems running from a symlink, you need to patch boot.rb to call realpath() (I found that in trac).

If the machine is multi-homed, you can probably do it with IP based virtual hosting.  Otherwise you could use allow/deny in htaccess, maybe even password do a through there.  If you want to go really small script/server has a -b (bind) argument and just have the public one in apache, apache/fastcgi is pretty bad, and I had a real hard time with some of the unusual things it did.