Normally in my vhost blocks I do:
Define SITE example.com
SSLCertificateFile /path/to/${SITE}.crt
SSLCertificateKeyFile /path/to/${SITE}.key
I'm wondering if it's possible to create a variable in Apache that would correspond to my filenames for example.com.crt
and example.com.key
?
I assume not, but it's worth asking to consolidate my vhost blocks.
For Apache, you can use mod_macro
First define a VHost Macro for repetitive configurations:
Then you can use of VHost with different arguments.
I've got 50 domains (like a.com, b.com, c.com, d.com, etc) based on the same wordpress code directory. While convert to https, every domain has its own certificate and private key files. I don't want to copy & paste & change the VirtualHost block codes for 50 times.
By mod_macro I don't need to do the VirtualHost block 50 times. I did it this way, which makes it easier. Below macro include redirect www to non-www domain name:
Apache wants to read the certificates on startup, so you won't be able to define them runtime (i.e. during handshake).