Apache Virtual host Subdomains points to same directory

Posted by Jakobud on Server Fault See other posts from Server Fault or by Jakobud
Published on 2009-12-11T19:15:07Z Indexed on 2010/03/19 13:31 UTC
Read the original article Hit count: 198

Filed under:
|
|
|
|

I have setup subdomains using Apache before and have never really ran into any big problems. But with this (I believe Centos) server that is one of my clients, I'm not understanding what I'm doing wrong. Here is the .conf that apache is loading:

Listen 80
NameVirtualHost *:80

<VirtualHost *:80>
    ServerName www.thedomain.com
    DocumentRoot /u1/thedomain.com/public
    RailsEnv production
</VirtualHost>

<VirtualHost *:80>
    ServerName subdomain.thedomain.com
    DocumentRoot /u1/subdomain.thedomain.com/public_html
</VirtualHost>

When I access either the primary or subdomain addresses, they both point to the primary www.thedomain.com content. Any thoughts?

UPDATE:

Yes I did a configtest and graceful after making the changes.

© Server Fault or respective owner

Related posts about apache

Related posts about virtualhosts