added support for includes and auths, extended docu

This commit is contained in:
nd 2020-04-18 22:29:15 +02:00
parent b1b10fad9b
commit 1ec6fbb1fd
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
8 changed files with 58 additions and 7 deletions

View file

@ -32,7 +32,7 @@ server {
proxy_pass {{ vhost.backend }};
# add proxy headers
proxy_set_header Host $host;
proxy_set_header Host {% if 'host' in vhost %}"{{ vhost.host }}"{% else %}$host{% endif %};
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
@ -61,8 +61,19 @@ server {
}
{% endfor %}
{% if vhost.auth.enable|default(False) %}
auth_basic "restricted area";
auth_basic_user_file {{ vhost.auth.path }};
satisfy {{ vhost.auth.satisfy|d('all') }};
{% endif %}
{% for include in vhost.includes|default([]) %}
include {{ include }};
{% endfor %}
{% if vhost.letsencrypt|d(False) %}
ssl_certificate /etc/ssl/nginx_{{ vhost_name }}.chain.crt;
ssl_certificate_key /etc/ssl/private/nginx_{{ vhost_name }}.key;
ssl_certificate /etc/ssl/nginx_{{ vhost_name }}.chain.crt;
ssl_certificate_key /etc/ssl/private/nginx_{{ vhost_name }}.key;
{% endif %}
}