Apache2 conditional section based on port
- by Waleed Hamra
I don't know much about if statements in apache configuration, and I'm wondering if I can have a section of the configuration applied only if the request is received on a certain port.
In short, this is about SSL. I have name based virtual hosts, I can make a configuration for port 80, then duplicate it all for port 443, and add the relevant SSL configurations.
But this seems redundant. I was wondering if i can have something like:
<VirtualHost *:80 *:443>
and then I can put:
<IfModule mod_ssl.c>
SSLEngine on
SSLCertificateFile ...
SSLCertificateKeyFile ...
SSLCACertificateFile ...
</IfModule>
inside an if statement that checks if connection is on port 443... or is such thing impossible? the server supports SNI, and I don't have any worries from non-SNI compliant browsers.