[Mongrel] my apache 2.2 conf

Steven Lumos steven at lumos.us
Thu Dec 21 14:20:38 EST 2006

I just finished updating our internal site, which hosts multiple Rails
apps, to Apache 2.2.3.  It also has a TWiki rewritten into the root,
ViewVC mounted on /cvs, and /server-status and /server-info.

<VirtualHost *:80>
  ServerName int.example.com
  ServerAlias int

  CustomLog /var/www/logs/int.example.com/access.log combined
  ErrorLog  /var/www/logs/int.example.com/error.log


  ## Application Server

  # APP1
  <Proxy balancer://app1>

  Alias /app1 /production/app1/public
  <Directory /production/app1/public>
    Allow from .example.com
    RewriteEngine on
    RewriteRule ^/?$ balancer://app1%{REQUEST_URI} [P,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . balancer://app1%{REQUEST_URI} [P,L]
  # End APP1

  # APP2
  <Proxy balancer://app2>

  Alias /app2 /dev/app2/public
  <Directory /dev/app2/public>
    Allow from .example.com
    RewriteEngine on
    RewriteRule ^/?$ balancer://app2%{REQUEST_URI} [P,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . balancer://app2%{REQUEST_URI} [P,L]
  # End APP2

Then I give mongrel_rails --prefix app<n> and done.  Almost too easy.
And it's going to be almost trivial to add more mongrels whenever we
need them and I set up mongrel_cluster.  Thanks again Zed and whoever
is responsible for mod_proxy(_balance).


More information about the Mongrel-users mailing list