Sunday, May 17, 2015

apache 2.2 - VirtualHost not using correct SSL certificate file

I got a doozy of a setup with my virtual hosts and SSL. I found the problem, I need a solution. The problem is, the way I have my virtual hosts and server names setup, the LAST VirtualHost directive is associating the SSL certificate file with the ServerName regardless of IP address or ServerAlias.



In this case, SSL on www.site1.com is using the cert file that is established on the last VirtualHost; www.site2.com.



Is this how it is supposed to work? This seems to be happening because both of them are using the same ServerName; but I wouldn't think this would be a problem. I am specifically using the same ServerName for a purpose and I really can't change that. So I need a good fix for this. Yes, I could buy another UCC SSL and have them both on it but I have already done that; these are actually UCC SSLs already. They just so happen to be two different UCC SSLs.




ServerName somename
ServerAlias www.site1.com

UseCanonicalName On
RewriteEngine On
RewriteOptions Inherit


ServerName somename
ServerAlias www.site1.com
UseCanonicalName On
SSLEngine on
SSLCertificateFile /usr/local/apache/conf/ssl.crt/cert1.crt

SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/cert1.key
SSLCertificateChainFile /usr/local/apache/conf/chain/gd_bundle.crt
RewriteEngine On
RewriteOptions Inherit



ServerName somename
ServerAlias www.site2.com
UseCanonicalName On

RewriteEngine On
RewriteOptions Inherit


ServerName somename
ServerAlias www.site2.com
UseCanonicalName On
SSLEngine on
SSLCertificateFile /usr/local/apache/conf/ssl.crt/cert2.crt
SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/cert2.key

SSLCertificateChainFile /usr/local/apache/conf/chain/gd_bundle.crt
RewriteEngine On
RewriteOptions Inherit

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...