Link to home
Start Free TrialLog in
Avatar of gf3
gf3

asked on

VHost Configuration Problem

I'm having a problem configuring a vhost. It's for a Ruby on Rails application, the problem is the vhost is being accessed from every subdomain, not just the one i would like it assigned to. Here is my configuration.

<VirtualHost *:80>

  ServerName appname.server.com
  DocumentRoot /var/www/rails/appname

  <Directory "/var/www/rails/appname/public">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>

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

  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE application/xhtml+xml

  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4.0[678] no-gzip
  BrowserMatch bMSIE !no-gzip !gzip-only-text/html

  php_value include_path /var/www/rails/appname/php:/usr/local/lib/php:.
# php_value auto_prepend_file /var/www/rails/appname/php/auto_prepend.php

  # this not only blocks access to .svn directories, but makes it appear
  # as though they aren't even there, not just that they are forbidden
  <DirectoryMatch "^/.*/\.svn/">
    ErrorDocument 403 /404.html
    Order allow,deny
    Deny from all
    Satisfy All
  </DirectoryMatch>

</VirtualHost>
Avatar of gf3
gf3

ASKER

OK I got that junk working! But I have a different problem now. I have configured another VHost, works great. The only problem is everything is served from that VHost and not the document root. Here is my VHost configuration:

<VirtualHost *:80>
        ServerName devo.server.com
        DocumentRoot /var/www-devo
        ServerAdmin gianni@server.com
        ErrorLog /var/log/httpd/devo.server.com-error_log
        CustomLog /var/log/httpd/devo.server.com-access_log common
        RewriteEngine On

        <Directory /var/www-devo>
                Options ExecCGI FollowSymLinks
                AllowOverride all
                Allow from all
                Order allow,deny
        </Directory>
</VirtualHost>
ASKER CERTIFIED SOLUTION
Avatar of samri
samri
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gf3

ASKER

Sorry I should have cancelled this question, the guys at irc.freenode.net#apache helped me figure it out. When adding a vhost you need to configure one for your primary domain as well. Otherwise the first one will be used as the default.
I am glad you had found a solution

You may request for PAQ/Refund in Community Support - https://www.experts-exchange.com/Community_Support/General/

or if you feel like awarding the pts, you could accept my answer since its very much telling the same thing.  

cheers.

Avatar of gf3

ASKER

yea no probs :)