I recently updated my ubuntu server to 10.04 and my virtualhost setup no longer working correctly.
I host two sites from my server and before the update the addresses linked correctly to their respective sites, but afterwards both addresses link to the same site, even though I have not made any changes to sites-available and both sites are enabled.
My setup is like this:
In /etc/apache2/sites-available/ I have two configuration files: "www.site1.com" and "www.site2.com"
thes configuration files are setup as follows:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName www.site1.com
ServerAlias site1.com
# Indexes + Directory Root.
# DirectoryIndex index.html index.htm index.php
DocumentRoot /home/www/www.site1.com/htdocs/
# CGI Directory
ScriptAlias /cgi-bin/ /home/www/www.site1.com/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /home/www/www.site1.com/logs/error.log
CustomLog /home/www/www.site1.com/logs/access.log combined
</VirtualHost>
in addition I have the following setup in /etc/apache2/ports.conf:
NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
NameVirtualHost *:443
Listen 443
</IfModule>
The only clue I have is when I restart apache I get the following errors:
[warn] NameVirtualHost *:443 has no VirtualHosts
[warn] NameVirtualHost *:80 has no VirtualHosts
This may be way to simplistic, but have you run a2ensite to create the symlinks back to the site-available folders?
ie: a2ensite www.site1.com
If I remember correctly, the configuration files aren't read from sites-available, only from site-enabled (the symlinks from sites-enables to sites-available) and could be the source of your warnings because Apache is not seeing any VirtualHosts being created when the configuration files are read.