added location support

This commit is contained in:
nd 2019-02-11 02:06:51 +01:00
parent 837e8e0531
commit ba448f3185
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
2 changed files with 22 additions and 0 deletions

View file

@ -62,5 +62,17 @@ backend: None
# Set ssl certs to letsencrypt paths and enable letsencrypt for this vhost
letsencrypt: False
# array of locations, see below
locations: [*locationconfig*, .. ]
```
**locationconfig**:
```
# a match definition, for example "/", see nginx docu: https://nginx.org/en/docs/http/ngx_http_core_module.html#location
match: ''
# path, only set if not none
alias: None
```

View file

@ -16,6 +16,10 @@ server {
listen [::]:{{ vhost_listen.nossl_port|default(80) }} ssl {% if vhost.default_server|default(False) %}default_server{% endif %};
{% endif %}
{% for header in vhost.add_headers|default([]) %}
add_header {{ header }} {{ vhost.add_headers[header] }};
{% endfor %}
{% if vhost.backend|default(False) %}
location / {
proxy_pass {{ vhost.backend }};
@ -36,6 +40,12 @@ server {
}
{% endif %}
{% for location in vhost.locations|default([]) %}
location {{ location.match }} {
{% if location.alias %}alias {{ location.alias }};{% endif %}
}
{% endfor %}
{% if vhost.letsencrypt|d(False) %}
ssl_certificate /etc/ssl/letsencrypt_{{ vhost_name }}_chained.crt;
ssl_certificate_key /etc/ssl/private/letsencrypt_{{ vhost_name }}.key;