I'm not new to apache, but I'm pulling my hair out on this one.
I can't get a 2nd VirtualHost up on a particular IP. It seems to just use the default VirtualHost for that IP.
I have a server which owns two IP addresses. It runs on ports 80 and 443 on both IPs, such that I have four NameVirtualHosts e.g.
NameVirtualHost 126.96.36.199:80 NameVirtualHost 188.8.131.52:443 NameVirtualHost 184.108.40.206:80 NameVirtualHost 220.127.116.11:443
Now I have a default (i.e. file is named such that it would be sourced before the next one) VirtualHost for 18.104.22.168:80 defined as
<VirtualHost 22.214.171.124:80> ServerAdmin firstname.lastname@example.org CustomLog /var/log/apache2/ip2-80-access.log combined ErrorLog /var/log/apache2/ip2-80-error.log </VirtualHost>
And a 2nd one
<VirtualHost 126.96.36.199:80> ServerAdmin email@example.com ServerName foo.example.com DocumentRoot /var/www/foo.example.com CustomLog /var/log/apache2/ip2-80-access.log combined ErrorLog /var/log/apache2/ip2-80-error.log </VirtualHost>
DNS is set up so that
foo.example.com points to
But when I try to access
foo.example.com/anything I get a 404 not found. It seems apache is ignoring my 2nd name-based and ip-based virtualhost.
I'm using Apache 2.2 on Debian 6 (Squeeze). Please note: I am not trying to get apache to choose a virtual host for SSL here (I am aware of limitations/SNI etc.), this is standard port 80.