From 2a388e7c489758d223e4d672de761fb0b928c723 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sun, 16 Apr 2023 00:27:13 +0200 Subject: [PATCH] If nginx_listenXXX is present, don't write proxy_protocol stuff --- templates/nginx.conf.j2 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index 8051616..bfd34e4 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -7,7 +7,6 @@ server { {% else %} listen 80; listen [::]:80; - {% endif %} {% if proxy_protocol is defined %} listen 81 proxy_protocol; @@ -22,6 +21,7 @@ server { port_in_redirect off; {% endif %} + {% endif %} server_name {{ domains | join(' ') }}; location / { @@ -45,8 +45,6 @@ server { {% else %} listen 443 ssl http2; listen [::]:443 ssl http2; - {% endif %} - server_name {% if redirect_to_first is not defined or not redirect_to_first %}{{ domains | join(' ') }}{% else %}{{ domains[0] }}{% endif %}; {% if proxy_protocol is defined %} listen 442 ssl http2 proxy_protocol; @@ -61,6 +59,8 @@ server { port_in_redirect off; {% endif %} + {% endif %} + server_name {% if redirect_to_first is not defined or not redirect_to_first %}{{ domains | join(' ') }}{% else %}{{ domains[0] }}{% endif %}; {% if ssl_certificate is defined -%} {{ ssl_certificate | indent(4) }} @@ -87,8 +87,6 @@ server { {% else %} listen 443 ssl http2; listen [::]:443 ssl http2; - {% endif %} - server_name {{ domains[1:] | join(' ') }}; {% if proxy_protocol is defined %} listen 442 ssl http2 proxy_protocol; @@ -103,6 +101,8 @@ server { port_in_redirect off; {% endif %} + {% endif %} + server_name {{ domains[1:] | join(' ') }}; {% if ssl_certificate is defined %} {{ ssl_certificate }}