Apache Dynamic Virtual Host with SSL [duplicate]
I have the following in my httpd.conf file
NameVirtualHost *:80
<IfModule mod_vhost_alias.c>
<VirtualHost *:80>
ServerAlias *
UseCanonicalName Off
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /var/log/httpd/access_log vcommon
VirtualDocumentRoot /web-data/vhosts/%0/httpdocs
VirtualScriptAlias /web-data/vhosts/%0/httpdocs
</VirtualHost>
</IfModule>
This works great for dynamic hosting. However, I can't figure out how to make https requests work the same way. What do I need to add to this so that https and http for the same domain request get sent to the same folder?
It is not technically possible with Apache2 to do this without a wildcard SSL certificate as Apache will have only 1 certificate to serve. I.e. your certificate will say it's for "myxtx.com" yet the request will be for "mydomain2.com".
See NameBasedSSLVHosts
However, it is possible using some extension but this is too complicated to explain all in one post here. So here is a link: NameBasedSSLVHostsWithSNI