[somewhat OT] Apache config for Rails + ColdFusion + PHP

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?

Thanks,
Chris

  1. a ColdFusion app located at /cf_app/
  2. 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

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]

an easier way would be to have aliases for php and coldfusion apps and
have the default location serverd be redirected to the mongrel
cluster. I am in the middle of setting something like that up now.
Only without the coldfusion.

On 7/27/06, Philip H. [email protected] wrote:

  1. a ColdFusion app located at /cf_app/

RewriteRule ^(.)$ $1 [QSA,L]
RewriteRule ^(.
)[^/]$ $1/ [QSA,L]

RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Elliott C.
[email protected]
[email protected]

Here is what I am working on right now:
<Proxy balancer://mycluster>
BalancerMember http://192.168.0.1:3000
BalancerMember http://192.168.0.1:3001
BalancerMember http://192.168.0.11:3000 loadfactor=2
BalancerMember http://192.168.0.11:3001 loadfactor=2

<Location /balancer-manager>
SetHandler balancer-manager

<Directory "/var/www/someplace>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all

Alias /someplace /var/www/someplace

<VirtualHost *:80>
ServerAdmin admin@localhost
ServerName www.site.com
ServerAlias site.com
ProxyPass / balancer://mycluster/
ProxyPassReverse / balancer://mycluster/

Most of my config came from
http://blog.innerewut.de/articles/2006/04/21/scaling-rails-with-apache-2-2-mod_proxy_balancer-and-mongrel
I haven’t tested it yet, but it should be close.

On 7/27/06, Elliott C. [email protected] wrote:

Our current setup for the Rails server is Apache2.2 with mod_proxy_balancer
processing.
RewriteEngine On



Elliott C.
[email protected]
[email protected]