Issue with CNAME and Virtual Hosts

Posted by mrc0der on Server Fault See other posts from Server Fault or by mrc0der
Published on 2012-11-10T03:03:29Z Indexed on 2012/11/10 5:02 UTC
Read the original article Hit count: 477

Filed under:
|
|
|

I'm using Apache and I have a CNAME DNS record for

sub2.sub1.domain1.com that points to sub1.domain1.com

And I have an A DNS record for

sub1.domain1.com that points to the IP.

Then in my httpd.conf file I have:

<VirtualHost *:80>
        ServerName www.domain1.com
        DocumentRoot /domain1/www
</VirtualHost>

<VirtualHost *:80>
        ServerName sub1.domain.com
        DocumentRoot /domain1/sub1/www
</VirtualHost>

Yet I appear to be missing something, as when you visit sub2.sub1.domain1.com, it shows you the page for domain1.com. When you visit the sub1.domain1.com, it shows the correct page for sub1.

© Server Fault or respective owner

Related posts about apache2

Related posts about dns