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.

Possible Duplicate:
Multiple SSL domains on the same IP address and same port?

I am trying to setup SSL certificate for my two domains on one apache web server. I do have two certificated for my two domains.

I have created two virtual hosts for my two domains :

<VirtualHost *:443>

NameVirtualHost *:443

ServerName domain1.com

...
..
SSLCertificateFile /etc/pki/tls/certs/domain1.cer

SSLCertificateKeyFile /etc/pki/tls/private/domain1.pem
..
</VirtualHost>



<VirtualHost *:443>

NameVirtualHost *:443

ServerName domain2.com

...

SSLCertificateFile /etc/pki/tls/certs/domain2.cer

SSLCertificateKeyFile /etc/pki/tls/private/domain2.pem

..
..
</VirtualHost>

The SSL certificate loads up and show valid certificate for domain1, but on visiting domain2, it loads up the domain1 certificate only.

What more changes do i need to do for this to work?

share|improve this question

marked as duplicate by MadHatter, Shane Madden, pauska, MDMarra, voretaq7 Jan 30 '12 at 21:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Do you have two IP addresses, or only one? –  MadHatter Jan 25 '12 at 6:24
    
One public IP address, both these domains are bind to one public ip address and I am doing this configuration on the same apache server only. –  Ankit Jan 25 '12 at 6:32
add comment

1 Answer

"As a rule, it is impossible to host more than one SSL virtual host on the same IP address and port. This is because Apache needs to know the name of the host in order to choose the correct certificate to setup the encryption layer. But the name of the host being requested is contained only in the HTTP request headers, which are part of the encrypted content. It is therefore not available until after the encryption is already negotiated. This means that the correct certificate cannot be selected, and clients will receive certificate mismatch warnings and be vulnerable to man-in-the-middle attacks." -- http://wiki.apache.org/httpd/NameBasedSSLVHosts

share|improve this answer
add comment

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