Topic: Debian 3.1 + Apache 2.0 + mod_proxy + Mongrel
At work I've been running lots of little rails apps that apache has been doing a good job of killing. I like to stay "stable" in a production environment so I was not able to move to Apache 2.2 + mod_proxy_balancer for a mongrel_cluster, but I still desired to have mongrel serve my rails content.
I've got a pretty good working solution right now and I thought I would share the steps it took to get it up and running.
* Apache 2.0 + mod_proxy + mod_rewrite
I'm not going to go into how to set them up, you'll have to google that yourself.
First, I run most of my applications under a subfolder, not a subdomain, ie http://myserver.com/helpdesk so I needed to modify the relative url:
# Placed at the top of config/routes.rb
ActionController::AbstractRequest.relative_url_root = "/helpdesk"
Second, set up apache to pass everything through the proxy. I did this in /etc/apache2/httpd.conf. There may be a better way/location for this but I'm not an apache 2 cowboy.
Allow from all
Third, configure the proxy for the specific rails app. I do this in the /etc/apache2/sites-available/mysite file (with mysite replaced with the actual filename)
# Enable Rewrite Engine
# All the other stuff goes here but has been truncated
# Helpdesk Proxy
ProxyPass /helpdesk/images !
ProxyPass /helpdesk/stylesheets !
That should be all we need to do configuration-wise, so now we fire up the mongrel server and restart apache
www:/home/helpdesk# mongrel_server start -e production -p 3000 -d -a 127.0.0.1
www:/# /etc/init.d/apache2 force-reload
That should get you a working system with mongrel doing your Rails & Apache doing everything else. You'll notice that this example does not deal with a mongrel_cluster, although you should be able to easily adapt it.