I have been battling this weird problem for hours. I think I have all files in order and things should work, but they do not. I have
- domain.com (alias: www.domain.com)
- subdomain.domain.com
This should be two different websites.
These are my config files (Ubuntu 10.04):
apache2.conf:
Include /etc/apache2/sites-enabled/
Include /opt/subdomain.conf
ports.conf:
NameVirtualHost 123.123.123.123:80
Listen 80
/etc/apache2/sites-enabled/000-default:
<VirtualHost 123.123.123.123:80>
DocumentRoot /home/landing/www
<Directory /home/landing/www>
Options None
AllowOverride None
</Directory>
</VirtualHost>
--> NOT specitying a ServerName. Catches requests to the IP, and indeed opens /home/landing/www
/etc/apache2/sites-enabled/domain1:
<VirtualHost 123.123.123.123:80>
ServerName domain1.com
DocumentRoot /home/domain1/www
ServerAlias www.domain1.com
<Directory /home/domain1/www>
Options None +FollowSymLinks
Order Allow,Deny
Allow from All
</Directory>
</VirtualHost>
--> This is for the main site. Opens fine, also with www.domain.com
/opt/subdomain.conf:
<VirtualHost 123.123.123.123:80>
ServerName subdomain.domain1.com
DocumentRoot "/opt/subdomain/www"
</VirtualHost>
--> Here is the problem. This does NOT open. It opens /home/landing/www instead...? This happens when I open ANY subdomain, so this whole config appears ignored. Anybody any idea why? Or how to check??