Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 1.1.1.1:80>
<VirtualHost 1.1.1.1:443> -> SSL 1

<VirtualHost 2.2.2.2:80>
<VirtualHost 2.2.2.2:4443> -> 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?

share|improve this question
    
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

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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