Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've been struggling with this one for hours and must have a really simple error!

I'm setting up an EC2 server and thus I've create 2 sub-domains from my currently live site and pointed the A records to the IP of my EC2 server.

on EC2 server I've got Apache in and running and the root website is running fine. However, my second site, which I'm using a vhosts definition shows the root site.

I then changed both sites to use vhosts and the root site to point to an empty directory and tried reversing the order of the definitions but it always displays the original root site.

Here are the specifics. sub-domain1.some-domain.com uses /var/www/html sub-domain2.some-domain.com should use /var/www/admin

extract from /etc/httpd/conf/httpd.conf

ServerName server2.some-domain.com

UseCanonicalName On

DocumentRoot "/var/www/dummy"

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot /var/www/admin
    ServerName subdomain2.some-domain.com

<VirtualHost *:80>
    DocumentRoot /var/www/html
    ServerName subdomain1.some-domain.com

Any pointers would be much appreciated.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.