New feature: custom location in vhost
parent
765ced9401
commit
c53ab5d008
|
@ -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 }}
|
||||
#
|
||||
|
@ -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 %}
|
||||
|
|
|
@ -19,6 +19,11 @@
|
|||
- 'test-alias.local'
|
||||
- 'test2-alias.local'
|
||||
template: '_base'
|
||||
location:
|
||||
'/test':
|
||||
- 'return 403;'
|
||||
'/gunther':
|
||||
- 'return 404;'
|
||||
- name:
|
||||
- 'test-php.local'
|
||||
redirect_from:
|
||||
|
|
Loading…
Reference in New Issue