|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Apache, Mongrel clusters and sub domainsThere seems to be a ton of documentation out there, but I can't seem to figure out how to get this to work. I've got two rails apps: app1, which should be available at http://www.domain.com and app2 which should be available at http://sub.domain.com. Both apps should be served up by a mongrel cluster (app1 running on ports 8000-8002 and app2 running on 9000-9002). App1 is working like a charm, however when I go to http://sub.domain.com, I get app1 instead of app2. As a side note, if I replace app2 with a static html page and take rails/mongrel out of the equation entirely, the subdomain works just like it's supposed to. My gut tells me it's how I've got my virtual host files set up (specifically the RewriteCond/RewriteRule parts). Could someone please point me in the right direction? Thanks! -Brian Physical location: ************************************** app1: /var/www/app1 app2: /var/www/app2 /etc/apache2/sites-available/default: ************************************** NameVirtualHost * <Proxy balancer://mongrel_cluster> BalancerMember http://localhost:8000 BalancerMember http://localhost:8001 BalancerMember http://localhost:8002 </Proxy> <VirtualHost *> ServerName domain.com DocumentRoot /var/www/app1/public/ . . . RewriteEngine On RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] </VirtualHost> /etc/apache2/sites-available/app2: ************************************** NameVirtualHost * <Proxy balancer://mongrel_cluster> BalancerMember http://localhost:9000 BalancerMember http://localhost:9001 BalancerMember http://localhost:9002 </Proxy> <VirtualHost *> ServerName sub.domain.com DocumentRoot /var/www/app2/public/ . . . RewriteEngine On RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] </VirtualHost> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@... To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Apache, Mongrel clusters and sub domainsI suspect your problem is that your clusters have the same name. You need something more like: <Proxy balancer://app1_mongrel_cluster> BalancerMember http://localhost:8000 BalancerMember http://localhost:8001 BalancerMember http://localhost:8002 </Proxy> <Proxy balancer://app2_mongrel_cluster> BalancerMember http://localhost:9000 BalancerMember http://localhost:9001 BalancerMember http://localhost:9002 </Proxy> Then of course update your rewrites to reflect that change. good luck! Tim On Jul 24, 12:26 pm, bmcelhany <bmcelh...@...> wrote: > There seems to be a ton of documentation out there, but I can't seem > to figure out how to get this to work. I've got two rails apps: app1, > which should be available athttp://www.domain.comand app2 which > should be available athttp://sub.domain.com. Both apps should be > served up by a mongrel cluster (app1 running on ports 8000-8002 and > app2 running on 9000-9002). App1 is working like a charm, however when > I go tohttp://sub.domain.com, I get app1 instead of app2. As a side > note, if I replace app2 with a static html page and take rails/mongrel > out of the equation entirely, the subdomain works just like it's > supposed to. > > My gut tells me it's how I've got my virtual host files set up > (specifically the RewriteCond/RewriteRule parts). Could someone please > point me in the right direction? Thanks! > > -Brian > > Physical location: > ************************************** > app1: /var/www/app1 > app2: /var/www/app2 > > /etc/apache2/sites-available/default: > ************************************** > NameVirtualHost * > <Proxy balancer://mongrel_cluster> > BalancerMemberhttp://localhost:8000 > BalancerMemberhttp://localhost:8001 > BalancerMemberhttp://localhost:8002 > </Proxy> > <VirtualHost *> > ServerName domain.com > DocumentRoot /var/www/app1/public/ > . > . > . > RewriteEngine On > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} > [P,QSA,L] > </VirtualHost> > > /etc/apache2/sites-available/app2: > ************************************** > NameVirtualHost * > <Proxy balancer://mongrel_cluster> > BalancerMemberhttp://localhost:9000 > BalancerMemberhttp://localhost:9001 > BalancerMemberhttp://localhost:9002 > </Proxy> > <VirtualHost *> > ServerName sub.domain.com > DocumentRoot /var/www/app2/public/ > . > . > . > RewriteEngine On > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} > [P,QSA,L] > </VirtualHost> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@... To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Apache, Mongrel clusters and sub domainsThanks for the quick response Tim! That ended up not being the problem but, after making the change you recommended, I stumbled across the problem. As I was re-starting both mongrel clusters (just to be on the safe side), I received an error that the cluster for app2 couldn't be shut down because of missing PID files. Sure enough, there should have been a mongrel.9000.pid, mongrel.9001.pid and mongrel.9002.pid file in the app2/tmp/pids directory but they weren't there. So, even though running "mongrel_rails cluster::start" seemed to be correctly starting the cluster, in actuality, nothing was starting. It turns out that somehow those files got deleted while the cluster was still running. I needed to manually kill the process on the server and then re-start the mongrel cluster for app2. Everything's working like a charm now. -Brian On Jul 24, 1:05 pm, Tim McIntyre <mcintyre....@...> wrote: > I suspect your problem is that your clusters have the same name. You > need something more like: > > <Proxy balancer://app1_mongrel_cluster> > BalancerMemberhttp://localhost:8000 > BalancerMemberhttp://localhost:8001 > BalancerMemberhttp://localhost:8002 > </Proxy> > > <Proxy balancer://app2_mongrel_cluster> > BalancerMemberhttp://localhost:9000 > BalancerMemberhttp://localhost:9001 > BalancerMemberhttp://localhost:9002 > </Proxy> > > Then of course update your rewrites to reflect that change. > > good luck! > Tim > > On Jul 24, 12:26 pm, bmcelhany <bmcelh...@...> wrote: > > > There seems to be a ton of documentation out there, but I can't seem > > to figure out how to get this to work. I've got two rails apps: app1, > > which should be available athttp://www.domain.comandapp2 which > > should be available athttp://sub.domain.com. Both apps should be > > served up by a mongrel cluster (app1 running on ports 8000-8002 and > > app2 running on 9000-9002). App1 is working like a charm, however when > > I go tohttp://sub.domain.com, I get app1 instead of app2. As a side > > note, if I replace app2 with a static html page and take rails/mongrel > > out of the equation entirely, the subdomain works just like it's > > supposed to. > > > My gut tells me it's how I've got my virtual host files set up > > (specifically the RewriteCond/RewriteRule parts). Could someone please > > point me in the right direction? Thanks! > > > -Brian > > > Physical location: > > ************************************** > > app1: /var/www/app1 > > app2: /var/www/app2 > > > /etc/apache2/sites-available/default: > > ************************************** > > NameVirtualHost * > > <Proxy balancer://mongrel_cluster> > > BalancerMemberhttp://localhost:8000 > > BalancerMemberhttp://localhost:8001 > > BalancerMemberhttp://localhost:8002 > > </Proxy> > > <VirtualHost *> > > ServerName domain.com > > DocumentRoot /var/www/app1/public/ > > . > > . > > . > > RewriteEngine On > > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > > RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} > > [P,QSA,L] > > </VirtualHost> > > > /etc/apache2/sites-available/app2: > > ************************************** > > NameVirtualHost * > > <Proxy balancer://mongrel_cluster> > > BalancerMemberhttp://localhost:9000 > > BalancerMemberhttp://localhost:9001 > > BalancerMemberhttp://localhost:9002 > > </Proxy> > > <VirtualHost *> > > ServerName sub.domain.com > > DocumentRoot /var/www/app2/public/ > > . > > . > > . > > RewriteEngine On > > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > > RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} > > [P,QSA,L] > > </VirtualHost> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@... To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free Forum Powered by Nabble | Forum Help |