added location support
This commit is contained in:
parent
837e8e0531
commit
ba448f3185
2 changed files with 22 additions and 0 deletions
12
README.md
12
README.md
|
|
@ -62,5 +62,17 @@ backend: None
|
||||||
|
|
||||||
# Set ssl certs to letsencrypt paths and enable letsencrypt for this vhost
|
# Set ssl certs to letsencrypt paths and enable letsencrypt for this vhost
|
||||||
letsencrypt: False
|
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
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@ server {
|
||||||
listen [::]:{{ vhost_listen.nossl_port|default(80) }} ssl {% if vhost.default_server|default(False) %}default_server{% endif %};
|
listen [::]:{{ vhost_listen.nossl_port|default(80) }} ssl {% if vhost.default_server|default(False) %}default_server{% endif %};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% for header in vhost.add_headers|default([]) %}
|
||||||
|
add_header {{ header }} {{ vhost.add_headers[header] }};
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% if vhost.backend|default(False) %}
|
{% if vhost.backend|default(False) %}
|
||||||
location / {
|
location / {
|
||||||
proxy_pass {{ vhost.backend }};
|
proxy_pass {{ vhost.backend }};
|
||||||
|
|
@ -36,6 +40,12 @@ server {
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% for location in vhost.locations|default([]) %}
|
||||||
|
location {{ location.match }} {
|
||||||
|
{% if location.alias %}alias {{ location.alias }};{% endif %}
|
||||||
|
}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% if vhost.letsencrypt|d(False) %}
|
{% if vhost.letsencrypt|d(False) %}
|
||||||
ssl_certificate /etc/ssl/letsencrypt_{{ vhost_name }}_chained.crt;
|
ssl_certificate /etc/ssl/letsencrypt_{{ vhost_name }}_chained.crt;
|
||||||
ssl_certificate_key /etc/ssl/private/letsencrypt_{{ vhost_name }}.key;
|
ssl_certificate_key /etc/ssl/private/letsencrypt_{{ vhost_name }}.key;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue