Apache Named Virtual Hosts and HTTPS

Posted by Freddie Witherden on Server Fault See other posts from Server Fault or by Freddie Witherden
Published on 2010-12-28T18:17:16Z Indexed on 2010/12/28 18:55 UTC
Read the original article Hit count: 218

Filed under:
|
|

I have an SSL certificate which is valid for multiple (sub-) domains. In Apache I have configured this as follows:

In /etc/apache2/apache2.conf

NameVirtualHost <my ip>:443

Then for one named virtual host I have

<VirtualHost <my ip>:443>
    ServerName ...

    SSLEngine on
    SSLCertificateFile ...
    SSLCertificateKeyFile ...
    SSLCertificateChainFile ...
    SSLCACertificateFile ...
</VirtualHost>

Finally, for every other site I want to be accessible over HTTPS I just have a

<VirtualHost <my ip>:443>
    ServerName ...
</VirtualHost>

The good news is that it works. However, when I start Apache I get warning messages

[warn] Init: SSL server IP/port conflict: Domain A:443 (...) vs. Domain B:443 (...)
[warn] Init: SSL server IP/port conflict: Domain C:443 (...) vs. Domain B:443 (...)
[warn] Init: You should not use name-based virtual hosts in conjunction with SSL!!

So, my question is: how should I be configuring this? Clearly from the warning messages I am doing something wrong (although it does work!), however, the above configuration was the only one I could get to work. It is somewhat annoying as the configuration files have an explicit dependence on my IP address.

© Server Fault or respective owner

Related posts about apache2

Related posts about virtualhosts