Topic: Setting up Mongrel and mod_proxy on a CPanel server

Having just moved to a new server and getting fed up with the quirks of getting FastCGI to work, I finally looked into Mongrel. It turns out it's pretty easy to set up, so I wrote this how-to on my blog and thought I'd share it here.

Installing Mongrel

This, amazingly, is a really simple three-step process as described on the Mongrel homepage:

$ sudo gem install mongrel
$ cd /home/USER/myrailsapp
$ mongrel_rails start -d

I was expecting to need to do more, but this much seriously will give you a mongrel server running in three commands. There

Last edited by adamp (2006-08-21 12:52:17)

Re: Setting up Mongrel and mod_proxy on a CPanel server

Thanks for the tutorial. It was so easy to follow, I was up and running in about 10 minutes.

After researching this topic more it seems the mod_proxy setup is pretty basic. From my understanding this setup is forwarding all requests for both ruby/rails files and static content to mongrel. Is this correct? How could I alter this setup so mongrel only handles rails/ruby requests and Apache handles everything else?

Re: Setting up Mongrel and mod_proxy on a CPanel server

I

My homepage: http://www.komendera.com/
Working at: http://www.abloom.at/
My blog: soaked and soaped http://soakedandsoaped.com/

Re: Setting up Mongrel and mod_proxy on a CPanel server

Irony indeed!

Thanks for the init script, Dieter. I hadn't got around to sorting a proper way of auto-starting/restarting yet as I'm currently only running a test app this way.

davidf8: My knowledge of mod_proxy is basic to say the least, but a quick look at the docs shows that you can exclude specific paths from the redirection, like so:

 ProxyPass /apache_stuff !
ProxyPass / http://www.supersonicfeet.com:8000/

Which would send (continuing my example from above) anything at http://adamsapp.supersonicfeet.com/ and below to Mongrel, except anything below http://adamsapp.supersonicfeet.com/apache_stuff - that would get handled by Apache as normal.

It looks like a long-winded solution if you have lots you need to separate, but you should be able to list exclusion commands as above with the ! argument.

If your app/site/requirements allow, then you could save time by putting anything Apache needs to handle in a /static or similar folder and just adding the exception for that before the ProxyPass directive, e.g.

ProxyPass /static !
ProxyPass / http://www.supersonicfeet.com:8000/

Last edited by adamp (2006-09-05 16:07:18)

Re: Setting up Mongrel and mod_proxy on a CPanel server

do you have a working link? http://www.supersonicfeet.com/2006/08/2 … e/#content is not working