I have a fresh minimal Debian Lenny server with one IP address running just Apache.
I have two domains, site1.com and site2.com for the purpose of this post, pointing to this one server. The www subdomain is a CNAME to the main domain. Pinging all four entries (the two domains with and without the www subdomain) all point to the correct IP address.
On the server, two virtual hosts have been added to /etc/apache2/sites-available/ as follows:
ServerName www.site1.com
ServerAlias site1.com
DocumentRoot /var/www.site1.com
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
ErrorLog /var/log/apache2/www.site1.com-error.log
LogLevel warn
CustomLog /var/log/apache2/www.site1.com-access.log combined
The second is just a copy of the above but with site2 references.
Having enabled both virtual hosts, and restarting Apache, site1.com, site2.com and www.site2.com all point to their correct sites. However for some annoying reason www.site1.com points to the default site (/etc/apache2/sites-available/default) for non-matching virtual hosts.
Can anyone explain why this is happening? I've checked and re-checked the configs, logs, directories and even re-built the server cleanly numerous times and fail to understand Apache's behaviour in this example.
Your help is appreciated.
Answer
I'm going with typo in the vhost's ServerName, or else the machine's ServerName points to www.site1.com and that's overriding the vhost's definition.
No comments:
Post a Comment