using mongrel to serve 2 rails apps

John Henderson wrote:

<snip/>

currently i have 2 mongrels running as follows:-

my main app on port 80 at www.myapp.com my forums app on port 81 at www.myapp.com

rather than giving out the URL www.myapp,com:81 for my forums, I would like to use www.myapp.com/forums and have this redirect invisibly to www.my.com:81

<snip/>

I'd suggest putting a web server with load balancing and proxying support in front of your mongrels such as Apache or Lighty. Then use the prefix feature of mongrel to bind app2 to /forums/.

--R

John Henderson wrote:

thanks Randall - i have lighty installed but i'm not sure how to 'put in in front' of the two mongrels...

presumably i start the 2 mongrels on some higher port numbers, say 8100 and 8101. then run lighty on port 80.

then do i not then need to tell lighty to bind /forums/ to the 2nd mongrel? (or something like that....)

cheers,

-john

You do need to tell Lighty where to find the mongrels it's forwarding to. Look into the documentation for Lighty's mod_proxy for the syntax.

Using your example; you want to forward / to your primary app at http://localhost:8100 and forward /forums/ to http:localhost:8101.

When you start the mongrel(s) for the forum application you need to be sure to pass the --prefix=/<name> option (e.g. mongrel_rails start --prefix=/forums -e production -d ) otherwise, your link_to, button_to et. al. will get confused and keep trying to send you back to app1.

--R