New feature: custom location in vhost

This commit is contained in:
Emilien Mantel
2015-07-31 00:38:16 +02:00
parent 765ced9401
commit c53ab5d008
2 changed files with 18 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
{% set __listen = item.listen | default(['80']) %}
{% set __listen_ssl = item.listen_ssl | default(['443']) %}
{% set __location = item.location | default({}) %}
#
# {{ ansible_managed }}
#
@@ -30,7 +31,7 @@ server {
{% block template_custom_location %}
{% endblock %}
location ~ /\.ht {
location ~ /\.ht {
deny all;
}
@@ -45,6 +46,17 @@ server {
log_not_found off;
}
{% if __location is iterable and __location | length > 0 %}
# --> Custom locations
{% for location, opts in __location.iteritems() %}
location {{ location }} {
{% for opt in opts %}
{{ opt }}
{% endfor %}
}
{% endfor %} # <-- Custom locations
{% endif %}
{% if item.use_access_log is defined and item.use_access_log %}
access_log {{ nginx_log_dir }}/{{ item.name }}_access.log combined;
{% else %}