Is there a way to share configuration directives across two nginx server {} blocks? I'd like to avoid duplicating the rules, as my site's HTTPS and HTTP content are served with the exact same config.
Currently, it's like this:
server {
listen 80;
...
}
server {
listen 443;
ssl on; # etc.
...
}
Can I do something along the lines of:
server {
listen 80, 443;
...
if(port == 443) {
ssl on; #etc
}
}
SSL on;as sugguested by user below. – ish1301 Nov 05 '14 at 15:58SSL online existence). I was forced to split ssl and non-ssl servers to separateserver{}blocks) – Artur Bodera Aug 01 '16 at 10:57serverblock. – rmn Sep 18 '18 at 12:09