multiple ssl virtual hosts on apache

In my use case, I had 2 certificates, one wildcard and one not. I put on a single file both configs:

<VirtualHost *.wildcard.com:443>
....



<VirtualHost normal.com:443>
...

but didn't work. The solution was this:

<VirtualHost *:443>
....



<VirtualHost *:443>
...

for both domains, provided that on every virtualhost definition you add the desired ServerName and ServerAlias:

   ServerName normal.com
   ServerAlias www.normal.com
   ServerAlias m.normal.com
   etc

After little more searching it turns out that it's possible (https://www.digicert.com/ssl-support/apache-multiple-ssl-certificates-using-sni.htm). My only problem was two separate configuration files for domains... when I configure virtualhost for domains in one config file it worked.

Tags:

Apache

Ssl