I'm working with a WordPress multi-site network that has various top-level domain names. We're currently serving them all up with one virtual host:
<VirtualHost *:80>
ServerName example.com
ServerAlias *
DocumentRoot /var/www/html/example.com/public
</VirtualHost>
With Let's Encrypt coming later this year, we'd like to offer free HTTPS to our customers. Using this service, we'd be able to automatically get a cert for each domain. I'd like to be able to configure Apache to look in a specific folder for the certificates so that our automated script doesn't need to change the Apache config when adding a new cert.
<VirtualHost *:443>
DocumentRoot /var/www/html/example.com/public
ServerName example.com
ServerAlias *
SSLEngine on
# This line should find the cert that corresponds to the requested domain
SSLCertificateFile /etc/pki/tls/certs/*.crt
SSLCertificateKeyFile /etc/pki/tls/private/example_com.key
SSLCertificateChainFile /etc/pki/tls/certs/example_com.ca-bundle
</VirtualHost>
Can Apache be configured to pick the right certificate for the requested domain without needing separate virtual hosts or config changes for each one?
We're open to switching Apache versions or installing a well-known Apache module if needed.