commit d4f39fa700ca6b4c93da05bf5aa5fc26d52d8ff1
parent 26cd064ce0331234fe07d35e690d71daab95905e
Author: Leah (ctucx) <leah@ctu.cx>
Date: Fri, 26 Feb 2021 14:15:55 +0100
parent 26cd064ce0331234fe07d35e690d71daab95905e
Author: Leah (ctucx) <leah@ctu.cx>
Date: Fri, 26 Feb 2021 14:15:55 +0100
roles/nginx: more options for vhost
1 file changed, 32 insertions(+), 0 deletions(-)
diff --git a/roles/nginx/templates/vhost.conf.j2 b/roles/nginx/templates/vhost.conf.j2 @@ -18,6 +18,14 @@ server { root {{ item.value.root }}; {% endif %} + {% if item.value.index is defined %} + index {{ item.value.index }}; + {% else %} + {% if item.value.enablePhpSupport is true %} + index index.php index.html; + {% endif %} + {% endif %} + {% if item.value.locations is defined %} {% for location in item.value.locations %} location {{ location.path }} { @@ -25,13 +33,21 @@ server { proxy_pass {{ location.proxy }}; include /etc/nginx/proxy.conf; {% endif %} + {% if location.root is defined %} root {{ location.root }}; {% endif %} + {% if location.directoryListing is true %} autoindex on; autoindex_exact_size off; {% endif %} + + {% if location.basicAuth is defined %} + auth_basic "{{ location.basicAuthReason | default('Authorization required') }}"; + auth_basic_user_file {{ location.basicAuth }}; + {% endif %} + {% if location.extraConfig is defined %} {{ location.extraConfig }} {% endif %} @@ -73,6 +89,14 @@ server { root {{ item.value.root }}; {% endif %} + {% if item.value.index is defined %} + index {{ item.value.index }}; + {% else %} + {% if item.value.enablePhpSupport is true %} + index index.php index.html; + {% endif %} + {% endif %} + {% if item.value.locations is defined %} {% for location in item.value.locations %} location {{ location.path }} { @@ -80,13 +104,21 @@ server { proxy_pass {{ location.proxy }}; include /etc/nginx/proxy.conf; {% endif %} + {% if location.root is defined %} root {{ location.root }}; {% endif %} + {% if location.directoryListing is true %} autoindex on; autoindex_exact_size off; {% endif %} + + {% if location.basicAuth is defined %} + auth_basic "{{ location.basicAuthReason | default('Authorization required') }}"; + auth_basic_user_file {{ location.basicAuth }}; + {% endif %} + {% if location.extraConfig is defined %} {{ location.extraConfig }} {% endif %}