Apache Virtual Hosts

I can get Apache to forward requests on the ip address of my computer to a rails app on mongrel using:

<VirtualHost *:80>

    ProxyPass / http://localhost:3000/     ProxyPassReverse / http://localhost:3000 </VirtualHost>

ie. http://nnn.nnn.nnn.nnn/ fires up my app on mongrel on port 3000 I want to have several different rails apps on different ports and do something like http://nnn.nnn.nnn.nnn/app1 goes to app1 mongrel on 3000 http://nnn.nnn.nnn.nnn/app2 goes to app2 mongrel on say 4000

I have played around with server names and server alias but have going around in circles.

Note that I have no DNS entry I am just going straight to the ip address at the moment.

Any tips would be appreciated.

Thanks giorgio

giorgio wrote:

I can get Apache to forward requests on the ip address of my computer to a rails app on mongrel using:

<VirtualHost *:80>

    ProxyPass / http://localhost:3000/     ProxyPassReverse / http://localhost:3000 </VirtualHost>

ie. http://nnn.nnn.nnn.nnn/ fires up my app on mongrel on port 3000 I want to have several different rails apps on different ports and do something like http://nnn.nnn.nnn.nnn/app1 goes to app1 mongrel on 3000 http://nnn.nnn.nnn.nnn/app2 goes to app2 mongrel on say 4000

I have played around with server names and server alias but have going around in circles.

Note that I have no DNS entry I am just going straight to the ip address at the moment.

Any tips would be appreciated.

Thanks giorgio

Scroll to the bottom of this thread:

and read the second to last reply in there. Read up from there if you don't understand what's going on.

Basically Mongrel has a --prefix switch that allows it to recognize that the Rails app is being called with a path prefix like your above example. Then you just have to fiddle with Apache to make sure the paths match up/pass through properly.

Remove the port from your virtual host statement. Under debian / ubuntu server edit or create the following file: /etc/apache2/conf.d/virtual.conf Add the following line: NameVirtualHost *

Good luck