# Adding a rails app to a subdomain

**URL:** <https://www.ruby-forum.com/t/adding-a-rails-app-to-a-subdomain/130367>\
**Category:** Rails\
**Created:** [February 27, 2008, 6:30pm UTC](https://www.ruby-forum.com/t/adding-a-rails-app-to-a-subdomain/130367 "2008-02-27T18:30:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![preppy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee7513/32.png) [@preppy](https://www.ruby-forum.com/u/preppy)\
**Post date:** [February 27, 2008, 6:30pm UTC](https://www.ruby-forum.com/t/adding-a-rails-app-to-a-subdomain/130367/1 "2008-02-27T18:30:54Z")

</div>

I’m trying to add a separate rails app to my existing rails app  
running on apache.

I followed the steps at this site ([http://blog.codahale.com/2006/06/19/](http://blog.codahale.com/2006/06/19/)  
time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/)

so my setup looks like this

/etc/apache2/http.conf

NameVirtualHost \*:80

\<Proxy \*\>  
Order allow,deny  
Allow from all

#gawkk main site  
Include /etc/apache2/conf.d/gawkk/gawkk.conf  
Include /etc/apache2/conf.d/gawkk/gawkk.cluster.conf

#blog  
Include /etc/apache2/conf.d/blog/blog.conf  
Include /etc/apache2/conf.d/blog/blog.cluster.conf

each of the sites have their own common file(i’m not sure if that’s  
the way it was suppose to be or not)

in the common file they have

ServerName blog.myapp.comm  
DocumentRoot /var/www/blog/current/public

RewriteCond %{DOCUMENT\_ROOT}/%{REQUEST\_FILENAME} !-f  
RewriteRule ^/(.\*)$ balancer://blog\_cluster%{REQUEST\_URI} [P,QSA,L]

ServerName www.myapp.comm  
DocumentRoot /var/www/myapp/current/public

RewriteCond %{DOCUMENT\_ROOT}/%{REQUEST\_FILENAME} !-f  
RewriteRule ^/(.\*)$ balancer://myapp\_cluster%{REQUEST\_URI} [P,QSA,L]

depending on which site i put first in the http.conf that cluster  
pulls all the requests.

I can’t seem to find a way to separate the domain and subdomain apart  
so that each cluster pulls the request.

Any help would be MUCH appreciated!
