RSS
6 Feb 2007

Apache2+mod_proxy with Mongrel for Development on Ubuntu Edgy

Author: ceefour | Filed under: Beginner, Opinions, Praises, Rails, Ruby, Tips, Web 2.0

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Alright, alright! So we want Apache back? But still retaining speedy Mongrel? No problemo.

The best way to use Mongrel with Apache is with Apache 2.2 and its mod_proxy_balancer. Unfortunately, Ubuntu Edgy currently uses Apache 2.0 that doesn’t have mod_proxy_balancer. Another unfortunate is that I’m too lazy to do the “hard stuff” (configure, make, etc.) just to run Apache 2.2.

But hey, you’re running on a development machine. No need for load balancing for now! Let’s enable mod_proxy first:

sudo a2enmod proxy

Then edit your corresponding virtual host configuration (in my configuration, e.g. sudo vim /etc/apache2/sites-available/cleanse.k8):

        ServerAdmin webmaster@localhost
        ServerName cleanse.k8
#
       
                Allow from all
       
#
#       Replace THINGS LIKE THESE:
#       DocumentRoot /shared/rails/cleanse/public
#      
#               AllowOverride All
#      
#
#       With THINGS LIKE THESE:
        ProxyPass / http://localhost:3021/
        ProxyPassReverse / http://localhost:3021/
        ProxyPreserveHost On

That’ll forward all requests to the Mongrel instance at port 3021. Now restart your Apache2 server and you’re good to go:

sudo /etc/init.d/apache2 restart

You may wonder, why would you use Apache just to proxy to Mongrel, if you aren’t using it for load balancing? I also don’t know! But at least I know it’s one way you can have virtual hosts with Mongrel. :-)

See Mongrel documentation about Apache for more details.

Technorati Tags: , , , , , ,

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

blog comments powered by Disqus