[Rails] [somewhat OT] Apache config for Rails + ColdFusion + PHP
Philip Hallstrom
rails at philip.pjkh.com
Thu Jul 27 17:52:03 GMT 2006
> Our group has several web apps developed in ColdFusion, PHP, and Rails. The
> ColdFusion and PHP apps are on an older server, and the Rails apps on a new
> server. Ideally, we'd like them all to share the same server.
>
> Our current setup for the Rails server is Apache2.2 with mod_proxy_balancer
> and mongrel_cluster. We'd like to have specific directories be processed
> and served by Apache instead of being handed off to mongrel_cluster. For
> example, let's say we have 3 applications:
>
> 1. our main website done in Rails located at the domain root
> 2. a ColdFusion app located at /cf_app/
> 3. a PHP app located at /php_app/.
>
> We'd like the ColdFusion and PHP apps to be served by Apache. Anything not
> in those two directories should be passed off to mongrel_cluster for
> processing.
>
> Any ideas on how to handle the Apache config for such a setup?
We don't have cold fusion and our PHP isn't as nicely isolated as that,
but this works for us:
<Proxy balancer://mongrel_cluster>
BalancerMember http://127.0.0.1:8805
</Proxy>
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/ [R]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} \.php
RewriteRule ^(.*)$ $1 [QSA,L]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME}/index.html -f
RewriteRule ^(.*)$ $1/index.html [QSA,L]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME}/index.php -f
RewriteRule ^(.*)$ $1/index.php [QSA,L]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -d
RewriteRule ^(.*)[^/]$ $1/ [QSA,L]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
More information about the Rails
mailing list