Sunday, February 21, 2016

Apache Virtual Host Multiple SSL Mappings Being Ignored




I have a VHOST configuration that I need a fresh set of eyes on. We have SSLEngine enabled in two virtual hosts - on on port 443 and another on port 4432. For some reason, regardless of whether the connection comes in on 443 or 4432 it automatically resorts to the first vhost defined. If I put 443 on top it uses that config for 443 and 4432 and if I put 4432 on top it uses that config for 443 and 4432. Can anyone tell me why it's just grabbing the top virtual host even though they only should be going to their respective ports? I know that SSL needs it's own IP but it's my understanding a separate Port should suffice too?



Listen *:443

SSLEngine On
SSLCertificateFile ...
SSLCertificateKeyFile ...
SSLCertificateChainFile ...
...



Listen *:4432

SSLEngine On
SSLCertificateFile a_different_file...
SSLCertificateKeyFile a_different_file...
SSLCertificateChainFile a_different_file...
...



Answer



Why not make all the SSL on port 443 and use vHosts to use multiple domains? You're trying to do that, but you're overlooking it. Try this:



NameVirtualHost *:443


insert ssl stuff1 here
ServerAdmin email@you.com
DocumentRoot "C:/xampp/htsecure1/"

ServerName domain1.com
ServerAlias www.domain1.com



insert ssl stuff2 here
ServerAdmin email@you.com
DocumentRoot "C:/xampp/htsecure2/"
ServerName domain2.com
ServerAlias www.domain2.com




insert ssl stuff3 here
ServerAdmin email@you.com
DocumentRoot "C:/xampp/htsecure3/"
ServerName domain3.com
ServerAlias www.domain3.com



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