Register now and start sharing your code snippets.
-->

Rails+Mongrel+Apache 2 on Mac OSX Leopard

Apache posted 6 months ago by christian

I use this configuration on my development machine when I need mod_rewrite; it’s not meant for production:

   1  <VirtualHost *:80>
   2  ServerName dev.xxx.com
   3  
   4  # Enable URL rewriting
   5  RewriteEngine On
   6  
   7  # Rewrite index to check for static pages
   8  RewriteRule ^/$ /index.html [QSA]
   9  
  10  # Rewrite to check for Rails cached page
  11  RewriteRule ^([^.]+)$ $1.html [QSA]
  12  
  13  # Redirect all non-static requests to cluster
  14  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  15  RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
  16  
  17  DocumentRoot  "/Users/christian/Documents/Projects/xxx/public"
  18  <Directory "/Users/christian/Documents/Projects/xxx/public">
  19       Options Indexes FollowSymLinks
  20  
  21       AllowOverride None
  22       Order allow,deny
  23       Allow from all
  24   </Directory>
  25  
  26  </VirtualHost>
  27  
  28  <Proxy balancer://mongrel_cluster>
  29    BalancerMember http://127.0.0.1:3000
  30  </Proxy>

Tagged apache, mongrel, osx, rails