Chris Selmer
2006-Jul-27 15:58 UTC
[Rails] [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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060727/14d757de/attachment.html
Philip Hallstrom
2006-Jul-27 17:47 UTC
[Rails] [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?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]
Elliott Clark
2006-Jul-27 18:06 UTC
[Rails] [somewhat OT] Apache config for Rails + ColdFusion + PHP
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 Hallstrom <rails@philip.pjkh.com> wrote:> > 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] > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Elliott Clark eclark@cc.gatech.edu eclark@nife.us
Elliott Clark
2006-Jul-27 18:29 UTC
[Rails] [somewhat OT] Apache config for Rails + ColdFusion + PHP
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 </Proxy> <Location /balancer-manager> SetHandler balancer-manager </Location> <Directory "/var/www/someplace> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </directory> Alias /someplace /var/www/someplace <VirtualHost *:80> ServerAdmin admin@localhost ServerName www.site.com ServerAlias site.com ProxyPass / balancer://mycluster/ ProxyPassReverse / balancer://mycluster/ </VirtualHost> 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 Clark <eclark@cc.gatech.edu> wrote:> 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 Hallstrom <rails@philip.pjkh.com> wrote: > > > 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] > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > Elliott Clark > eclark@cc.gatech.edu > eclark@nife.us >-- Elliott Clark eclark@cc.gatech.edu eclark@nife.us