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/pu blic">
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.htm l -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/loca l/lib/php: .
# php_value auto_prepend_file /var/www/rails/appname/php /auto_prep end.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>
<VirtualHost *:80>
ServerName appname.server.com
DocumentRoot /var/www/rails/appname
<Directory "/var/www/rails/appname/pu
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
RewriteRule ^(.+[^/])$ $1/ [R]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST
RewriteRule ^(.*)$ $1 [QSA,L]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST
RewriteRule ^(.*)$ $1/index.html [QSA,L]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST
RewriteRule ^(.*)$ $1/index.php [QSA,L]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST
RewriteRule ^(.*)[^/]$ $1/ [QSA,L]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST
RewriteRule ^/(.*)$ balancer://mongrel_cluster
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
# php_value auto_prepend_file /var/www/rails/appname/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>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
ASKER
yea no probs :)
ASKER
<VirtualHost *:80>
ServerName devo.server.com
DocumentRoot /var/www-devo
ServerAdmin gianni@server.com
ErrorLog /var/log/httpd/devo.server
CustomLog /var/log/httpd/devo.server
RewriteEngine On
<Directory /var/www-devo>
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>