Virtual hosts in apache2-2.2.0-21 don't work correctly. Instead, any request to the server defaults to one vhost regardless of the hostname used to call it.
My /etc/apache2/vhosts.d/intranet.conf:
Code:
<VirtualHost intranet:80>
ServerAdmin stuart@intranet
ServerName intranet
DocumentRoot /srv/www/vhosts/intranet
ErrorLog /var/log/apache2/intranet-error_log
CustomLog /var/log/apache2/intranet-access_log combined
# Needed for name-based vhosts.
UseCanonicalName Off
ServerSignature On
# This also does DirectoryIndex index.php, so I don't need to worry about
# DirectoryIndex'es:
Include /etc/apache2/conf.d/php5.conf
ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
ErrorDocument 404 "/srv/www/vhosts/intranet/404.php"
<Directory "/srv/www/vhosts/intranet">
Options Indexes FollowSymLinks
AllowOverride None
Allow from 10.0.1.*
</Directory>
</VirtualHost>
My /etc/apache2/vhosts.d/stumo.dyndns.org.conf:
Code:
<VirtualHost *:80>
ServerAdmin stuart@stumo.dyndns.org
ServerName stumo.dyndns.org
DocumentRoot /srv/www/vhosts/stumo.dyndns.org
ErrorLog /var/log/apache2/stumo.dyndns.org-error_log
CustomLog /var/log/apache2/stuno.dyndns.org-access_log combined
# don't loose time with IP address lookups
HostnameLookups Off
# needed for named virtual hosts
UseCanonicalName Off
# configures the footer on server-generated documents
ServerSignature On
# Optionally, include *.conf files from /etc/apache2/conf.d/
# For example, to allow execution of PHP scripts:
# Include /etc/apache2/conf.d/mod_php4.conf
# or, to include all configuration snippets added by packages:
Include /etc/apache2/conf.d/*.conf
# /etc/apache2/conf.d/php5.conf does a DirectoryIndex index.php,
# so I don't need to worry about putting DirectoryIndices in this file
# There was a load of waffle (# commented) here about what ScriptAlias is, I removed it because comments don't make any difference and
# I didn't want to take up ten lines of space of crap not about virtual hosts, in a forum thread about virtual hosts.
ScriptAlias /cgi-bin/ "/srv/www/vhosts/stumo.dyndns.org/cgi-bin/"
# More waffle.
<Directory "/srv/www/vhosts/stumo.dyndns.org/cgi-bin">
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>
# Irrelevant waffle about UserDir stuff.
<Directory "/srv/www/vhosts/stumo.dyndns.org">
# More waffle.
Options Indexes FollowSymLinks
# More waffle here.
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Other stuff:
The server is behind NAT.
The server's own actual hostname is intranet (I just thought that that may be what is affecting this, since the files that it serves up are always from the /srv/www/vhosts/intranet/ directory, irrespective of whether it's called using the name 'intranet' or the name 'stumo.dyndns.org' or the name '10.0.1.34'.)
But anyway, I quite hope that someone here can figure this out, that would be great, and if you need to see any other files like the main httpd.conf or any other file to try to solve this, then just ask or whatever.