1

I have configured a virtual host on 80 and 443 ports (Centos 5.6 and Apache 2.2.3), following is the configuration I have written:

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 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 the abc.be is working fine, but 2nd domain abc.fr still sends the first SSL.

Following is 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)  

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

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

0

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.

  • 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
0

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
...

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.