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.

I have configure virtual host on 80 and 443 port(Centos 5.6 and apache 2.2.3), following is the sample, i have wrote the configuration in same order

Listen 80  
Listen 443  
NameVirtualHost *:80  
NameVirtualHost *:443  
<VirtualHost *:80>  
ServerAdmin webmaster@abc.be  
ServerName  www.abc.be  
ServerAlias abc.be  
.  
. 
</VirtualHost>
<VirtualHost *:80>  
ServerAdmin webmaster@abc.fr  
ServerName  www.abc.fr  
ServerAlias abc.fr  
.  
. 
</VirtualHost>  

then i have define 443

<VirtualHost *:443>  
ServerAdmin webmaster@abc.be  
ServerName  www.abc.be  
ServerAlias abc.be  
.  
.  
SSLEngine on  
SSLCertificateFile /etc/ssl/private/abc.be.crt  
SSLCertificateKeyFile /etc/ssl/private/abc.be.key  
SSLCertificateChainFile /etc/ssl/private/gd_bundle_be.crt
</VirtualHost>  
<VirtualHost *:443>  
ServerAdmin webmaster@abc.fr  
ServerName  www.abc.fr  
ServerAlias abc.fr  
.  
.  
SSLEngine on  
SSLCertificateFile /etc/ssl/private/abc.fr.crt  
SSLCertificateKeyFile /etc/ssl/private/abc.fr.key  
SSLCertificateChainFile /etc/ssl/private/gd_bundle_fr.crt
</VirtualHost>  

First ssl certificate for abc.be is working fine, but 2nd domian abc.fr still load first ssl.

following the output of apachictl -s

VirtualHost configuration:  
wildcard NameVirtualHosts and _default_ servers:  
*:443                  is a NameVirtualHost  
default server www.abc.be (/etc/httpd/conf/httpd.conf:1071)  
port 443 namevhost www.abc.fr (/etc/httpd/conf/httpd.conf:1071)  

Thanks

share|improve this question
    
You should also read this: wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI –  Bruno Sep 28 '12 at 20:44
add comment

migrated from stackoverflow.com Sep 29 '12 at 0:11

This question came from our site for professional and enthusiast programmers.

2 Answers

That's entirely expected. See Why is it not possible to use Name-Based Virtual Hosting to identify different SSL virtual hosts? and for a possible solution, Server Name Indication.

share|improve this answer
    
Hi, As per mentioned in link, it required apache version 2.2.2 and latest version of web browser. I am already using latest version of browser and apache version of 2.2.3. –  user1703321 Sep 28 '12 at 21:04
    
Hi, As per mentioned in link, it required apache version 2.2.2 and latest version of web browser. I am already using latest version of browser and apache version of 2.2.3. But openssl version should be 0.9.8j or latter. But on my server openssl version is 0.9.8e. Now let me update openssl and see the output. –  user1703321 Sep 28 '12 at 21:12
    
@user1703321: It is also mentioned that you need openssl 0.9.8f+. I think Centos 5.6 has an older openssl library. –  Lacek Oct 1 '12 at 10:01
add comment

If you have more than one IP address, or can get one, you can bind each SSL host to a different IP.

<VirtualHost 1.2.4.5:443>  
ServerAdmin webmaster@abc.be  
ServerName  www.abc.be  
ServerAlias abc.be  
...
SSLEngine on  
SSLCertificateFile /etc/ssl/private/abc.be.crt  
SSLCertificateKeyFile /etc/ssl/private/abc.be.key  
SSLCertificateChainFile /etc/ssl/private/gd_bundle_be.crt 
...

<VirtualHost 5.6.7.8:443>    
ServerAdmin webmaster@abc.fr  
ServerName  www.abc.fr  
ServerAlias abc.fr  
...
SSLEngine on  
SSLCertificateFile /etc/ssl/private/abc.fr.crt  
SSLCertificateKeyFile /etc/ssl/private/abc.fr.key  
SSLCertificateChainFile /etc/ssl/private/gd_bundle_fr.crt
...
share|improve this answer
add comment

Your Answer

 
discard

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