Apache, Mongrel clusters and sub domains

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 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:

I 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

Thanks 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