Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Is this possible to do in apache?

I need to have a rails site, with a subdirectory controlled by PHP, or have a PHP site with a subdirectory that is a rails application. Is this possible?

I used to do it all the time in IIS but not sure about apache.

share|improve this question

It's definitely possible.

If you're using Passenger in Apache, you're after the RailsBaseURI option - follow the link for an example VirtualHost. If you're using a separate Ruby app-server (Mongrel, Thin, etc) then you can just use Apache's mod_proxy to point to the port on which it's running.

share|improve this answer
I am using passenger. I'll take a look at that, thanks. – fregas Mar 31 '11 at 22:27
So this seems to be able to make a rails site go under a php site. Is there a way to do the reverse? – fregas Apr 7 '11 at 22:44

I don't have experience with Ruby but you can use mod_proxy under apache to send subdirectories to different locations. So you would have a normal site running php/apache and then proxy /foo to mongrel on a different port.

Apache Mod_Proxy Documentation

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.