We have an Ubuntu 10.04 server running Apache 2.2.14 with 4 ip-based virtual hosts. We have 2 ip addresses and a ssl cert for each ip address. ex:

<VirtualHost> -> SSL 1

<VirtualHost> -> SSL 2

No matter what we do, for some reason, Apache will always find the first virtual host included but not the second when serving https requests. This results in apache serving the ssl cert from the first vhost included for BOTH ipaddress. A very undesirable result.

All of the ip address configurations are correct. Running apache2ctl -S says that all configurations are correct.

We do not use any name-based virtual hosts.

It does not matter which :443 vhost is included first, apache will only serve the cert from the first vhost included.

It is our understanding that apache will default to using the first vhost that it finds as the default if it does not find a virtual host for the ip address:port.

Why would this be happening?

  • Post the output of httpd -t -D DUMP_VHOSTS. – jgoldschrafe Dec 20 '10 at 15:36
  • Are the IP addresses correctly attached to the server, or do you have a private ip address on your server that they route to? – Andy Dec 20 '10 at 15:41
  • In order to get this setup working for the moment, we changed the second vhost:443 do to default:443. Here is the link to the output of the command above -> pastebin.com/p6AamHcz – liferealized Dec 20 '10 at 15:51
  • The .235 vhost works fine and is not included in the example above. – liferealized Dec 20 '10 at 15:52

Looks like Apache2 requires the ServerName directive for all <VirtualHost>s. Our two SSL vhosts were ending up having the same ServerName and one would end up being the default for both IP addresses.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.