2019-02-22 17:48:17 +01:00
{{ ansible_managed | comment }}
2019-01-03 23:13:56 +01:00
2019-05-21 17:23:06 +02:00
{% if item.value.upstreams is defined and item.value.upstreams %}
2018-10-16 20:52:04 +02:00
{% for upstream in item.value.upstreams %}
upstream {{ item.value.upstreams[upstream].name }} {
2019-11-29 04:21:32 +01:00
{% if item.value.upstreams[upstream].lb_method is defined and item.value.upstreams[upstream].lb_method | length %}
2018-10-16 20:52:04 +02:00
{{ item.value.upstreams[upstream].lb_method }};
2019-11-29 04:21:32 +01:00
{% endif %}
2019-11-21 13:15:18 +01:00
{% if item.value.upstreams[upstream].zone_name is defined and item.value.upstreams[upstream].zone_name %}
2018-10-16 20:52:04 +02:00
zone {{ item.value.upstreams[upstream].zone_name }} {{ item.value.upstreams[upstream].zone_size }};
2019-11-21 13:15:18 +01:00
{% endif %}
2018-10-16 20:52:04 +02:00
{% for server in item.value.upstreams[upstream].servers %}
2020-06-22 20:54:29 +02:00
server {{ item.value.upstreams[upstream].servers[server].address }}{{(":" + item.value.upstreams[upstream].servers[server].port | string) if item.value.upstreams[upstream].servers[server].port is defined}} weight={{ item.value.upstreams[upstream].servers[server].weight | default("1") }} {{ item.value.upstreams[upstream].servers[server].health_check | default("") }};
2018-10-16 20:52:04 +02:00
{% endfor %}
{% if item.value.upstreams[upstream].sticky_cookie %}
sticky cookie srv_id expires=1h path=/;
{% endif %}
2019-10-20 17:52:56 +02:00
{% if item.value.upstreams[upstream].custom_options is defined and item.value.upstreams[upstream].custom_options | length %}
{% for inline_option in item.value.upstreams[upstream].custom_options %}
2020-06-09 18:23:38 +02:00
{{ inline_option }}
2019-10-20 17:52:56 +02:00
{% endfor %}
{% endif %}
2018-10-16 20:52:04 +02:00
}
{% endfor %}
{% endif %}
2018-01-26 20:00:26 +01:00
2019-11-26 00:46:03 +01:00
{% if item.value.proxy_cache is defined and item.value.proxy_cache %}
{% if item.value.proxy_cache.proxy_cache_path is defined and item.value.proxy_cache.proxy_cache_path %}
{% for proxy_cache_path in item.value.proxy_cache.proxy_cache_path %}
2019-02-12 16:12:40 +01:00
proxy_cache_path {{ proxy_cache_path.path }} keys_zone={{ proxy_cache_path.keys_zone.name }}:{{ proxy_cache_path.keys_zone.size }}
2019-11-25 22:51:54 +01:00
levels={{ proxy_cache_path.levels }} max_size={{ proxy_cache_path.max_size }}
inactive={{ proxy_cache_path.inactive }} use_temp_path={{ proxy_cache_path.use_temp_path | ternary("on", "off") }};
2019-02-12 16:12:40 +01:00
{% endfor %}
2019-11-26 00:46:03 +01:00
{% if item.value.proxy_cache.proxy_cache_background_update is defined and item.value.proxy_cache.proxy_cache_background_update%}
proxy_cache_background_update {{ item.value.proxy_cache.proxy_cache_background_update | ternary("on", "off") }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.proxy_cache.proxy_cache_lock is defined and item.value.proxy_cache.proxy_cache_lock %}
proxy_cache_lock {{ item.value.proxy_cache.proxy_cache_lock | ternary("on", "off") }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.proxy_cache.proxy_cache_min_uses is defined and item.value.proxy_cache.proxy_cache_min_uses %}
proxy_cache_min_uses {{ item.value.proxy_cache.proxy_cache_min_uses }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.proxy_cache.proxy_cache_revalidate is defined and item.value.proxy_cache.proxy_cache_revalidate %}
proxy_cache_revalidate {{ item.value.proxy_cache.proxy_cache_revalidate | ternary("on", "off") }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.proxy_cache.proxy_cache_use_stale is defined and item.value.proxy_cache.proxy_cache_use_stale %}
proxy_cache_use_stale {{ item.value.proxy_cache.proxy_cache_use_stale | join(" ") }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.proxy_cache.proxy_ignore_headers is defined and item.value.proxy_cache.proxy_ignore_headers %}
proxy_ignore_headers {{ item.value.proxy_cache.proxy_ignore_headers | join(" ") }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.proxy_cache.proxy_temp_path is defined and item.value.proxy_cache.proxy_temp_path.path %}
proxy_temp_path {{ item.value.proxy_cache.proxy_temp_path.path }} {{ item.value.proxy_cache.proxy_temp_path.level_1 | default("") }} {{ item.value.proxy_cache.proxy_temp_path.level_2 | default("") }} {{ item.value.proxy_cache.proxy_temp_path.level_3 | default("") }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.proxy_cache.proxy_cache_valid is defined %}
{% for proxy_cache_valid in item.value.proxy_cache.proxy_cache_valid %}
2019-11-25 22:51:54 +01:00
{% if proxy_cache_valid.code is defined %}
proxy_cache_valid {{ proxy_cache_valid.code }} {{ proxy_cache_valid.time | default("10m") }};
{% elif proxy_cache_valid.time is defined and proxy_cache_valid.code is not defined %}
proxy_cache_valid {{ proxy_cache_valid.time }};
{% endif %}
{% endfor %}
{% endif %}
2019-02-12 16:12:40 +01:00
{% endif %}
{% endif %}
2019-04-18 11:51:44 +02:00
{% if item.value.auth_request_http is defined %}
auth_request {{ item.value.auth_request_http }};
{% endif %}
2019-07-12 20:14:46 +02:00
{% if item.value.auth_request_set_http is defined %}
auth_request_set {{ item.value.auth_request_set_http.name }} {{ item.value.auth_request_set_http.value }};
{% endif %}
2019-02-12 16:12:40 +01:00
2019-11-26 00:46:03 +01:00
{% if item.value.custom_options is defined and item.value.custom_options | length %}
{% for inline_option in item.value.custom_options %}
2020-06-09 18:23:38 +02:00
{{ inline_option }}
2019-10-20 17:52:56 +02:00
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers is defined %}
{% for server in item.value.servers %}
2018-10-16 20:52:04 +02:00
server {
2019-11-26 00:46:03 +01:00
{% for listen in item.value.servers[server].listen %}
2020-01-09 16:40:36 +01:00
listen {% if item.value.servers[server].listen[listen].ip is defined and item.value.servers[server].listen[listen].ip | length %}{{ item.value.servers[server].listen[listen].ip }}:{% endif %}{{ item.value.servers[server].listen[listen].port }}{% if item.value.servers[server].listen[listen].ssl is defined and item.value.servers[server].listen[listen].ssl %} ssl{% endif %}{% if item.value.servers[server].listen[listen].opts is defined and item.value.servers[server].listen[listen].opts | length %} {{ item.value.servers[server].listen[listen].opts | join(" ") }}{% endif %};
2019-07-29 19:39:58 +02:00
{% endfor %}
2019-11-26 00:46:03 +01:00
server_name {{ item.value.servers[server].server_name | default('localhost') }};
{% if item.value.servers[server].ssl is defined and item.value.servers[server].ssl %}
ssl_certificate {{ item.value.servers[server].ssl.cert }};
ssl_certificate_key {{ item.value.servers[server].ssl.key }};
{% if item.value.servers[server].ssl.trusted_cert is defined %}
ssl_trusted_certificate {{ item.value.servers[server].ssl.trusted_cert }};
2019-07-12 19:55:37 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].ssl.dhparam is defined %}
ssl_dhparam {{ item.value.servers[server].ssl.dhparam }};
2019-04-08 15:16:28 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].ssl.protocols is defined and item.value.servers[server].ssl.protocols %}
ssl_protocols {{ item.value.servers[server].ssl.protocols }};
2019-02-22 18:28:19 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].ssl.ciphers is defined and item.value.servers[server].ssl.ciphers %}
ssl_ciphers {{ item.value.servers[server].ssl.ciphers }};
2019-02-22 18:28:19 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].ssl.prefer_server_ciphers is defined and item.value.servers[server].ssl.prefer_server_ciphers %}
2019-07-12 19:56:11 +02:00
ssl_prefer_server_ciphers on;
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].ssl.session_cache is defined and item.value.servers[server].ssl.session_cache %}
ssl_session_cache {{ item.value.servers[server].ssl.session_cache }};
2019-02-22 18:28:19 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].ssl.session_timeout is defined and item.value.servers[server].ssl.session_timeout %}
ssl_session_timeout {{ item.value.servers[server].ssl.session_timeout }};
2019-02-22 18:28:19 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].ssl.disable_session_tickets is defined and item.value.servers[server].ssl.disable_session_tickets %}
2019-07-15 14:41:04 +02:00
ssl_session_tickets off;
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].ssl.stapling is defined and item.value.servers[server].ssl.stapling %}
2019-07-12 19:55:37 +02:00
ssl_stapling on;
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].ssl.stapling_verify is defined and item.value.servers[server].ssl.stapling_verify %}
2019-07-12 19:55:37 +02:00
ssl_stapling_verify on;
{% endif %}
2020-05-25 13:59:38 +02:00
{% if item.value.servers[server].ssl.ecdh_curve is defined and item.value.servers[server].ssl.ecdh_curve %}
ssl_ecdh_curve {{ item.value.servers[server].ssl.ecdh_curve }};
{% endif %}
{% if item.value.servers[server].ssl.buffer_size is defined and item.value.servers[server].ssl.buffer_size %}
ssl_buffer_size {{ item.value.servers[server].ssl.buffer_size }};
{% endif %}
2018-10-16 20:52:04 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].include_files is defined and item.value.servers[server].include_files | length %}
{% for file in item.value.servers[server].include_files %}
2019-07-17 13:32:47 +02:00
include "{{ file }}";
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].proxy_hide_headers is defined %}
{% for header in item.value.servers[server].proxy_hide_headers %}
2019-07-15 14:49:10 +02:00
proxy_hide_header {{ header }};
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].add_headers is defined %}
{% for header in item.value.servers[server].add_headers %}
add_header {{ item.value.servers[server].add_headers[header].name }} "{{ item.value.servers[server].add_headers[header].value }}"{% if item.value.servers[server].add_headers[header].always is defined and item.value.servers[server].add_headers[header].always %} always{% endif %};
2019-06-14 12:33:50 +02:00
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].auth_basic is defined and item.value.servers[server].auth_basic %}
auth_basic "{{ item.value.servers[server].auth_basic }}";
2019-05-20 15:48:24 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].auth_basic_user_file is defined and item.value.servers[server].auth_basic_user_file %}
auth_basic_user_file {{ item.value.servers[server].auth_basic_user_file }};
2019-05-20 15:48:24 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].root is defined and item.value.servers[server].root %}
root {{ item.value.servers[server].root }};
2018-11-26 20:06:46 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].https_redirect is defined and item.value.servers[server].https_redirect %}
2019-12-07 05:51:11 +01:00
return 301 https://{{ item.value.servers[server].https_redirect }}$request_uri;
2019-02-15 14:59:38 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].autoindex is defined and item.value.servers[server].autoindex %}
2019-02-15 14:59:38 +01:00
autoindex on;
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].try_files is defined %}
try_files {{ item.value.servers[server].try_files }};
2019-04-04 20:09:42 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].auth_request is defined %}
auth_request {{ item.value.servers[server].auth_request }};
2019-04-18 11:51:44 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].auth_request_set is defined %}
auth_request_set {{ item.value.servers[server].auth_request_set.name }} {{ item.value.servers[server].auth_request_set.value }};
2019-07-12 20:14:46 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].client_max_body_size is defined and item.value.servers[server].client_max_body_size %}
client_max_body_size {{ item.value.servers[server].client_max_body_size }};
2019-07-15 20:42:15 +02:00
{% endif %}
2020-02-15 00:54:31 +01:00
{% if item.value.servers[server].sub_filter.sub_filters is defined and item.value.servers[server].sub_filter.sub_filters | length %}
{% for sub_filter in item.value.servers[server].sub_filter.sub_filters %}
sub_filter {{ sub_filter }};
{% endfor %}
{% endif %}
{% if item.value.servers[server].sub_filter.last_modified is defined %}
sub_filter_last_modified {{ item.value.servers[server].sub_filter.last_modified | ternary("on", "off") }};
{% endif %}
{% if item.value.servers[server].sub_filter.once is defined %}
sub_filter_once {{ item.value.servers[server].sub_filter.once | ternary("on", "off") }};
{% endif %}
{% if item.value.servers[server].sub_filter.types is defined and item.value.servers[server].sub_filter.types %}
sub_filter_types {{ item.value.servers[server].sub_filter.types }};
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].custom_options is defined and item.value.servers[server].custom_options | length %}
{% for inline_option in item.value.servers[server].custom_options %}
2020-06-09 18:23:38 +02:00
{{ inline_option }}
2019-10-20 17:52:56 +02:00
{% endfor %}
{% endif %}
2019-04-18 11:51:44 +02:00
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy is defined and item.value.servers[server].reverse_proxy %}
{% for location in item.value.servers[server].reverse_proxy.locations %}
location {{ item.value.servers[server].reverse_proxy.locations[location].location }} {
{% if item.value.servers[server].reverse_proxy.locations[location].internal is sameas true %}
2019-04-18 11:51:44 +02:00
internal;
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].include_files is defined and item.value.servers[server].reverse_proxy.locations[location].include_files | length %}
{% for file in item.value.servers[server].reverse_proxy.locations[location].include_files %}
2019-07-17 13:32:47 +02:00
include "{{ file }}";
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_hide_headers is defined %}
{% for header in item.value.servers[server].reverse_proxy.locations[location].proxy_hide_headers %}
2019-07-15 14:49:10 +02:00
proxy_hide_header {{ header }};
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].add_headers is defined %}
{% for header in item.value.servers[server].reverse_proxy.locations[location].add_headers %}
add_header {{ item.value.servers[server].reverse_proxy.locations[location].add_headers[header].name }} "{{ item.value.servers[server].reverse_proxy.locations[location].add_headers[header].value }}"{% if item.value.servers[server].reverse_proxy.locations[location].add_headers[header].always is defined and item.value.servers[server].reverse_proxy.locations[location].add_headers[header].always %} always{% endif %};
2019-06-14 12:33:50 +02:00
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].auth_request is defined %}
auth_request {{ item.value.servers[server].reverse_proxy.locations[location].auth_request }};
2019-04-18 11:51:44 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].auth_request_set is defined %}
auth_request_set {{ item.value.servers[server].reverse_proxy.locations[location].auth_request_set.name }} {{ item.value.servers[server].reverse_proxy.locations[location].auth_request_set.value }};
2019-07-12 20:14:46 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].auth_basic is defined and item.value.servers[server].reverse_proxy.locations[location].auth_basic %}
auth_basic "{{ item.value.servers[server].reverse_proxy.locations[location].auth_basic }}";
2019-02-12 13:32:11 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].auth_basic_user_file is defined and item.value.servers[server].reverse_proxy.locations[location].auth_basic_user_file %}
auth_basic_user_file {{ item.value.servers[server].reverse_proxy.locations[location].auth_basic_user_file }};
2019-03-07 21:34:22 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].returns is defined %}
{% for code in item.value.servers[server].reverse_proxy.locations[location].returns %}
{% if item.value.servers[server].reverse_proxy.locations[location].returns[code] is defined %}
return {{ item.value.servers[server].reverse_proxy.locations[location].returns[code].code }} {{ item.value.servers[server].reverse_proxy.locations[location].returns[code].url }};
2019-04-18 11:51:44 +02:00
{% else %}
2019-11-26 00:46:03 +01:00
return {{ item.value.servers[server].reverse_proxy.locations[location].returns[code].url }};
2019-04-18 11:51:44 +02:00
{% endif %}
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_connect_timeout is defined and item.value.servers[server].reverse_proxy.locations[location].proxy_connect_timeout %}
proxy_connect_timeout {{ item.value.servers[server].reverse_proxy.locations[location].proxy_connect_timeout }};
2019-02-12 13:32:11 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
proxy_pass {{ item.value.servers[server].reverse_proxy.locations[location].proxy_pass }};
{% if item.value.servers[server].reverse_proxy.locations[location].rewrites is defined %}
{% for rewrite in item.value.servers[server].reverse_proxy.locations[location].rewrites %}
2019-11-04 23:41:25 +01:00
rewrite {{ rewrite }};
{% endfor %}
2019-07-26 23:21:34 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_read_timeout is defined and item.value.servers[server].reverse_proxy.locations[location].proxy_read_timeout %}
proxy_read_timeout {{ item.value.servers[server].reverse_proxy.locations[location].proxy_read_timeout }};
2019-03-07 21:34:22 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_send_timeout is defined and item.value.servers[server].reverse_proxy.locations[location].proxy_send_timeout %}
proxy_send_timeout {{ item.value.servers[server].reverse_proxy.locations[location].proxy_send_timeout }};
2019-11-21 13:15:18 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_pass_request_body is defined %}
proxy_pass_request_body {{ item.value.servers[server].reverse_proxy.locations[location].proxy_pass_request_body }};
2019-04-18 11:51:44 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_store is defined %}
proxy_store {{ item.value.servers[server].reverse_proxy.locations[location].proxy_store | ternary("on", "off") }};
2019-04-18 11:51:44 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_store_access is defined %}
proxy_store_access {{ item.value.servers[server].reverse_proxy.locations[location].proxy_store_access }};
2019-04-18 11:51:44 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].allows is defined %}
{% for allow in item.value.servers[server].reverse_proxy.locations[location].allows %}
2019-08-05 20:20:12 +02:00
allow {{ allow }};
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].denies is defined %}
{% for deny in item.value.servers[server].reverse_proxy.locations[location].denies %}
2019-08-05 20:20:12 +02:00
deny {{ deny }};
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_set_header is defined %}
{% for header in item.value.servers[server].reverse_proxy.locations[location].proxy_set_header %}
proxy_set_header {{ item.value.servers[server].reverse_proxy.locations[location].proxy_set_header[header].name }} {{ item.value.servers[server].reverse_proxy.locations[location].proxy_set_header[header].value }};
2019-04-18 11:51:44 +02:00
{% endfor %}
2020-05-29 18:00:26 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_http_version is defined %}
proxy_http_version {{ item.value.servers[server].reverse_proxy.locations[location].proxy_http_version }};
2019-07-12 19:59:25 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].websocket is defined and item.value.servers[server].reverse_proxy.locations[location].websocket %}
2019-07-12 19:59:25 +02:00
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].try_files is defined %}
try_files {{ item.value.servers[server].reverse_proxy.locations[location].try_files }};
2019-04-04 20:09:42 +02:00
{% endif %}
2019-02-22 18:28:19 +01:00
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_ssl is defined and item.value.servers[server].reverse_proxy.locations[location].proxy_ssl %}
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.cert is defined %}
proxy_ssl_certificate {{ item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.cert }};
2019-02-22 18:28:19 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.key is defined %}
proxy_ssl_certificate_key {{ item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.key }};
2019-02-22 18:28:19 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.trusted_cert is defined %}
proxy_ssl_trusted_certificate {{ item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.trusted_cert }};
2019-02-22 18:28:19 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.server_name is defined %}
proxy_ssl_server_name {{ item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.server_name | ternary("on", "off") }};
2019-02-22 18:28:19 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.name is defined %}
proxy_ssl_name {{ item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.name }};
2019-02-22 18:28:19 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.protocols is defined %}
proxy_ssl_protocols {{ item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.protocols }};
2019-02-22 18:28:19 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.ciphers is defined %}
proxy_ssl_ciphers {{ item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.ciphers }};
2019-02-22 18:28:19 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.verify is defined %}
proxy_ssl_verify {{ item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.verify | ternary("on", "off") }};
2019-02-22 18:28:19 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.verify_depth is defined %}
proxy_ssl_verify_depth {{ item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.verify_depth }};
2019-02-22 18:28:19 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.session_reuse is defined %}
proxy_ssl_session_reuse {{ item.value.servers[server].reverse_proxy.locations[location].proxy_ssl.session_reuse | ternary("on", "off") }};
2019-02-22 18:28:19 +01:00
{% endif %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_redirect is defined %}
proxy_redirect {{ item.value.servers[server].reverse_proxy.locations[location].proxy_redirect | ternary(item.value.servers[server].reverse_proxy.locations[location].proxy_redirect, "off") }};
2019-02-18 15:23:57 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_cache is defined %}
proxy_cache {{ item.value.servers[server].reverse_proxy.locations[location].proxy_cache }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_cache_valid is defined %}
{% for proxy_cache_valid in item.value.servers[server].reverse_proxy.locations[location].proxy_cache_valid %}
2019-11-25 22:51:54 +01:00
{% if proxy_cache_valid.code is defined %}
proxy_cache_valid {{ proxy_cache_valid.code }} {{ proxy_cache_valid.time | default("10m") }};
{% elif proxy_cache_valid.time is defined and proxy_cache_valid.code is not defined %}
proxy_cache_valid {{ proxy_cache_valid.time }};
{% endif %}
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_cache_background_update is defined %}
proxy_cache_background_update {{ item.value.servers[server].reverse_proxy.locations[location].proxy_cache_background_update | ternary("on", "off") }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_cache_lock is defined %}
proxy_cache_lock {{ item.value.servers[server].reverse_proxy.locations[location].proxy_cache_lock | ternary("on", "off") }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_cache_min_uses is defined %}
proxy_cache_min_uses {{ item.value.servers[server].reverse_proxy.locations[location].proxy_cache_min_uses }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_cache_revalidate is defined %}
proxy_cache_revalidate {{ item.value.servers[server].reverse_proxy.locations[location].proxy_cache_revalidate | ternary("on", "off") }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_cache_use_stale is defined %}
proxy_cache_use_stale {{ item.value.servers[server].reverse_proxy.locations[location].proxy_cache_use_stale | join(" ") }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_temp_path is defined %}
proxy_temp_path {{ item.value.servers[server].reverse_proxy.locations[location].proxy_temp_path.path }} {{ item.value.servers[server].reverse_proxy.locations[location].proxy_temp_path.level_1 | default("") }} {{ item.value.servers[server].reverse_proxy.locations[location].proxy_temp_path.level_2 | default("") }} {{ item.value.servers[server].reverse_proxy.locations[location].proxy_temp_path.level_3 | default("") }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_ignore_headers is defined %}
proxy_ignore_headers {{ item.value.servers[server].reverse_proxy.locations[location].proxy_ignore_headers | join(" ") }};
2019-02-12 16:12:40 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].client_max_body_size is defined and item.value.servers[server].reverse_proxy.locations[location].client_max_body_size %}
client_max_body_size {{ item.value.servers[server].reverse_proxy.locations[location].client_max_body_size }};
2019-07-15 20:42:15 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_cookie_path is defined %}
proxy_cookie_path {{ item.value.servers[server].reverse_proxy.locations[location].proxy_cookie_path.path }} {{ item.value.servers[server].reverse_proxy.locations[location].proxy_cookie_path.replacement }};
2019-07-15 18:58:35 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].proxy_buffering is defined %}
proxy_buffering {{ item.value.servers[server].reverse_proxy.locations[location].proxy_buffering | ternary("on", "off") }};
2019-07-15 14:41:19 +02:00
{% endif %}
2020-02-15 00:54:31 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].sub_filter.sub_filters is defined and item.value.servers[server].reverse_proxy.locations[location].sub_filter.sub_filters | length %}
{% for sub_filter in item.value.servers[server].reverse_proxy.locations[location].sub_filter.sub_filters %}
sub_filter {{ sub_filter }};
{% endfor %}
{% endif %}
{% if item.value.servers[server].reverse_proxy.locations[location].sub_filter.last_modified is defined %}
sub_filter_last_modified {{ item.value.servers[server].reverse_proxy.locations[location].sub_filter.last_modified | ternary("on", "off") }};
{% endif %}
{% if item.value.servers[server].reverse_proxy.locations[location].sub_filter.once is defined %}
sub_filter_once {{ item.value.servers[server].reverse_proxy.locations[location].sub_filter.once | ternary("on", "off") }};
{% endif %}
{% if item.value.servers[server].reverse_proxy.locations[location].sub_filter.types is defined and item.value.servers[server].reverse_proxy.locations[location].sub_filter.types %}
sub_filter_types {{ item.value.servers[server].reverse_proxy.locations[location].sub_filter.types }};
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].reverse_proxy.locations[location].custom_options is defined and item.value.servers[server].reverse_proxy.locations[location].custom_options | length %}
{% for inline_option in item.value.servers[server].reverse_proxy.locations[location].custom_options %}
2020-06-09 18:23:38 +02:00
{{ inline_option }}
2019-10-20 17:52:56 +02:00
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if (item.value.servers[server].reverse_proxy.health_check_plus is defined) and item.value.servers[server].reverse_proxy.health_check_plus %}
2018-10-16 20:52:04 +02:00
health_check;
{% endif %}
2019-02-12 16:12:40 +01:00
2018-01-26 20:00:26 +01:00
}
2018-11-13 07:57:44 +01:00
{% endfor %}
2018-10-16 20:52:04 +02:00
{% endif %}
2019-02-12 16:12:40 +01:00
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].web_server is defined %}
{% for location in item.value.servers[server].web_server.locations %}
location {{ item.value.servers[server].web_server.locations[location].location }} {
{% if item.value.servers[server].web_server.locations[location].html_file_location is defined %}
root {{ item.value.servers[server].web_server.locations[location].html_file_location }};
2019-07-15 19:12:44 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].web_server.locations[location].html_file_name is defined %}
index {{ item.value.servers[server].web_server.locations[location].html_file_name }};
2019-07-15 19:12:44 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].web_server.locations[location].autoindex | default(false) %}
2018-11-26 20:06:46 +01:00
autoindex on;
2019-02-12 13:32:11 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].web_server.locations[location].try_files is defined %}
try_files {{ item.value.servers[server].web_server.locations[location].try_files }};
2019-04-04 20:09:42 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].web_server.locations[location].include_files is defined and item.value.servers[server].web_server.locations[location].include_files | length %}
{% for file in item.value.servers[server].web_server.locations[location].include_files %}
2019-07-17 13:32:47 +02:00
include "{{ file }}";
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].web_server.locations[location].custom_options is defined and item.value.servers[server].web_server.locations[location].custom_options | length %}
{% for inline_option in item.value.servers[server].web_server.locations[location].custom_options %}
2020-06-09 18:23:38 +02:00
{{ inline_option }}
2019-10-20 17:52:56 +02:00
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].web_server.locations[location].proxy_hide_headers is defined %}
{% for header in item.value.servers[server].web_server.locations[location].proxy_hide_headers %}
2019-07-15 14:49:10 +02:00
proxy_hide_header {{ header }};
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].web_server.locations[location].add_headers is defined %}
{% for header in item.value.servers[server].web_server.locations[location].add_headers %}
add_header {{ item.value.servers[server].web_server.locations[location].add_headers[header].name }} "{{ item.value.servers[server].web_server.locations[location].add_headers[header].value }}"{% if item.value.servers[server].web_server.locations[location].add_headers[header].always is defined and item.value.servers[server].web_server.locations[location].add_headers[header].always %} always{% endif %};
2019-06-14 12:33:50 +02:00
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].web_server.locations[location].returns is defined %}
{% for code in item.value.servers[server].web_server.locations[location].returns %}
{% if item.value.servers[server].web_server.locations[location].returns[code] is defined %}
return {{ item.value.servers[server].web_server.locations[location].returns[code].code }} {{ item.value.servers[server].web_server.locations[location].returns[code].url }};
2019-04-18 11:51:44 +02:00
{% else %}
2019-11-26 00:46:03 +01:00
return {{ item.value.servers[server].web_server.locations[location].returns[code].url }};
2019-04-18 11:51:44 +02:00
{% endif %}
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].web_server.locations[location].auth_basic is defined and item.value.servers[server].web_server.locations[location].auth_basic %}
auth_basic "{{ item.value.servers[server].web_server.locations[location].auth_basic }}";
2019-02-12 13:32:11 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].web_server.locations[location].auth_basic_user_file is defined and item.value.servers[server].web_server.locations[location].auth_basic_user_file %}
auth_basic_user_file {{ item.value.servers[server].web_server.locations[location].auth_basic_user_file }};
2019-04-18 11:51:44 +02:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].web_server.locations[location].auth_request is defined %}
auth_request {{ item.value.servers[server].web_server.locations[location].auth_request }};
2018-11-26 20:06:46 +01:00
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].web_server.locations[location].auth_request_set is defined %}
auth_request_set {{ item.value.servers[server].web_server.locations[location].auth_request_set.name }} {{ item.value.servers[server].web_server.locations[location].auth_request_set.value }};
2019-07-12 20:14:46 +02:00
{% endif %}
2020-02-15 00:54:31 +01:00
{% if item.value.servers[server].web_server.locations[location].sub_filter.sub_filters is defined and item.value.servers[server].web_server.locations[location].sub_filter.sub_filters | length %}
{% for sub_filter in item.value.servers[server].web_server.locations[location].sub_filter.sub_filters %}
sub_filter {{ sub_filter }};
{% endfor %}
{% endif %}
{% if item.value.servers[server].web_server.locations[location].sub_filter.last_modified is defined %}
sub_filter_last_modified {{ item.value.servers[server].web_server.locations[location].sub_filter.last_modified | ternary("on", "off") }};
{% endif %}
{% if item.value.servers[server].web_server.locations[location].sub_filter.once is defined %}
sub_filter_once {{ item.value.servers[server].web_server.locations[location].sub_filter.once | ternary("on", "off") }};
{% endif %}
{% if item.value.servers[server].web_server.locations[location].sub_filter.types is defined and item.value.servers[server].web_server.locations[location].sub_filter.types %}
sub_filter_types {{ item.value.servers[server].web_server.locations[location].sub_filter.types }};
{% endif %}
2019-07-12 20:14:46 +02:00
2018-10-16 20:52:04 +02:00
}
2018-11-14 17:33:54 +01:00
{% endfor %}
2020-06-29 15:56:45 +02:00
{% if item.value.servers[server].web_server.http_demo_conf is defined and item.value.servers[server].web_server.http_demo_conf %}
2018-10-16 20:52:04 +02:00
sub_filter_once off;
sub_filter 'server_hostname' '$hostname';
sub_filter 'server_address' '$server_addr:$server_port';
sub_filter 'server_url' '$request_uri';
sub_filter 'remote_addr' '$remote_addr:$remote_port';
sub_filter 'server_date' '$time_local';
sub_filter 'client_browser' '$http_user_agent';
sub_filter 'request_id' '$request_id';
sub_filter 'nginx_version' '$nginx_version';
sub_filter 'document_root' '$document_root';
sub_filter 'proxied_for_ip' '$http_x_forwarded_for';
{% endif %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].returns is defined %}
{% for return in item.value.servers[server].returns %}
location {{ item.value.servers[server].returns[return].location }} {
return {{ item.value.servers[server].returns[return].code }}{% if item.value.servers[server].returns[return].value is defined %} {{ item.value.servers[server].returns[return].value }}{% endif %};
2019-07-17 14:10:09 +02:00
}
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].error_page is defined %}
2018-01-26 20:00:26 +01:00
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
2019-11-26 00:46:03 +01:00
root {{ item.value.servers[server].error_page }};
2018-01-26 20:00:26 +01:00
}
2018-10-16 20:52:04 +02:00
{% endif %}
2019-10-02 19:29:59 +02:00
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].access_log is defined %}
{% for access_log in item.value.servers[server].access_log %}
2019-10-02 19:29:59 +02:00
access_log {{ access_log.location }} {{ access_log.name }};
{% endfor %}
{% endif %}
2019-11-26 00:46:03 +01:00
{% if item.value.servers[server].error_log is defined %}
error_log {{ item.value.servers[server].error_log.location }} {{ item.value.servers[server].error_log.level }};
2019-10-02 19:29:59 +02:00
{% endif %}
2019-05-21 17:23:06 +02:00
}
2019-11-26 00:46:03 +01:00
{% endfor %}
{% endif %}