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 }} {
{{ item.value.upstreams[upstream].lb_method }};
zone {{ item.value.upstreams[upstream].zone_name }} {{ item.value.upstreams[upstream].zone_size }};
{% for server in item.value.upstreams[upstream].servers %}
2018-11-09 11:28:16 +01:00
server {{ item.value.upstreams[upstream].servers[server].address }}:{{ item.value.upstreams[upstream].servers[server].port }} 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 %}
}
{% endfor %}
{% endif %}
2018-01-26 20:00:26 +01:00
2019-05-21 17:23:06 +02:00
{% if item.value.reverse_proxy is defined and item.value.reverse_proxy %}
{% if item.value.reverse_proxy.proxy_cache_path is defined and item.value.reverse_proxy.proxy_cache_path %}
2019-02-12 16:12:40 +01:00
{% for proxy_cache_path in item.value.reverse_proxy.proxy_cache_path %}
proxy_cache_path {{ proxy_cache_path.path }} keys_zone={{ proxy_cache_path.keys_zone.name }}:{{ proxy_cache_path.keys_zone.size }}
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") }};
{% endfor %}
2019-05-21 17:23:06 +02:00
{% if item.value.reverse_proxy.proxy_cache_background_update is defined and item.value.reverse_proxy.proxy_cache_background_update%}
2019-02-12 16:12:40 +01:00
proxy_cache_background_update {{ item.value.reverse_proxy.proxy_cache_background_update | ternary("on", "off") }};
{% endif %}
2019-05-21 17:23:06 +02:00
{% if item.value.reverse_proxy.proxy_cache_lock is defined and item.value.reverse_proxy.proxy_cache_lock %}
2019-02-12 16:12:40 +01:00
proxy_cache_lock {{ item.value.reverse_proxy.proxy_cache_lock | ternary("on", "off") }};
{% endif %}
2019-05-21 17:23:06 +02:00
{% if item.value.reverse_proxy.proxy_cache_min_uses is defined and item.value.reverse_proxy.proxy_cache_min_uses %}
2019-02-12 16:12:40 +01:00
proxy_cache_min_uses {{ item.value.reverse_proxy.proxy_cache_min_uses }};
{% endif %}
2019-05-21 17:23:06 +02:00
{% if item.value.reverse_proxy.proxy_cache_revalidate is defined and item.value.reverse_proxy.proxy_cache_revalidate %}
2019-02-12 16:12:40 +01:00
proxy_cache_revalidate {{ item.value.reverse_proxy.proxy_cache_revalidate | ternary("on", "off") }};
{% endif %}
2019-05-21 17:23:06 +02:00
{% if item.value.reverse_proxy.proxy_cache_use_stale is defined and item.value.reverse_proxy.proxy_cache_use_stale %}
2019-02-12 16:12:40 +01:00
proxy_cache_use_stale {{ item.value.reverse_proxy.proxy_cache_use_stale | join(" ") }};
{% endif %}
2019-05-21 17:23:06 +02:00
{% if item.value.reverse_proxy.proxy_ignore_headers is defined and item.value.reverse_proxy.proxy_ignore_headers %}
2019-02-12 16:12:40 +01:00
proxy_ignore_headers {{ item.value.reverse_proxy.proxy_ignore_headers | join(" ") }};
{% endif %}
2019-05-21 17:23:06 +02:00
{% if item.value.reverse_proxy.proxy_temp_path is defined and item.value.reverse_proxy.proxy_temp_path.path %}
2019-02-12 16:12:40 +01:00
proxy_temp_path {{ item.value.reverse_proxy.proxy_temp_path.path }} {{ item.value.reverse_proxy.proxy_temp_path.level_1 | default("") }} {{ item.value.reverse_proxy.proxy_temp_path.level_2 | default("") }} {{ item.value.reverse_proxy.proxy_temp_path.level_3 | default("") }};
{% endif %}
{% 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
2018-10-16 20:52:04 +02:00
server {
2019-07-29 19:39:58 +02:00
{% for listen in item.value.listen %}
listen {% if item.value.listen[listen].ip is defined and item.value.listen[listen].ip | length %}{{ item.value.listen[listen].ip }}:{% endif %}{{ item.value.listen[listen].port }}{% if item.value.ssl is defined and item.value.ssl %} ssl{% endif %}{% if item.value.listen[listen].opts is defined and item.value.listen[listen].opts | length %} {{ item.value.listen[listen].opts | join(" ") }}{% endif %};
{% endfor %}
server_name {{ item.value.server_name | default('localhost') }};
2019-05-21 17:23:06 +02:00
{% if item.value.ssl is defined and item.value.ssl %}
2019-01-14 17:26:37 +01:00
ssl_certificate {{ item.value.ssl.cert }};
ssl_certificate_key {{ item.value.ssl.key }};
2019-07-12 19:55:37 +02:00
{% if item.value.ssl.trusted_cert is defined %}
ssl_trusted_certificate {{ item.value.ssl.trusted_cert }};
{% endif %}
2019-04-08 15:16:28 +02:00
{% if item.value.ssl.dhparam is defined %}
ssl_dhparam {{ item.value.ssl.dhparam }};
{% endif %}
2019-05-21 17:23:06 +02:00
{% if item.value.ssl.protocols is defined and item.value.ssl.protocols %}
2019-02-22 18:28:19 +01:00
ssl_protocols {{ item.value.ssl.protocols }};
{% endif %}
2019-05-21 17:23:06 +02:00
{% if item.value.ssl.ciphers is defined and item.value.ssl.ciphers %}
2019-02-22 18:28:19 +01:00
ssl_ciphers {{ item.value.ssl.ciphers }};
{% endif %}
2019-07-12 19:56:11 +02:00
{% if item.value.ssl.prefer_server_ciphers is defined and item.value.ssl.prefer_server_ciphers %}
ssl_prefer_server_ciphers on;
{% endif %}
2019-05-21 17:23:06 +02:00
{% if item.value.ssl.session_cache is defined and item.value.ssl.session_cache %}
2019-02-22 18:28:19 +01:00
ssl_session_cache {{ item.value.ssl.session_cache }};
{% endif %}
2019-05-21 17:23:06 +02:00
{% if item.value.ssl.session_timeout is defined and item.value.ssl.session_timeout %}
2019-02-22 18:28:19 +01:00
ssl_session_timeout {{ item.value.ssl.session_timeout }};
{% endif %}
2019-07-15 14:41:04 +02:00
{% if item.value.ssl.disable_session_tickets is defined and item.value.ssl.disable_session_tickets %}
ssl_session_tickets off;
{% endif %}
2019-07-12 19:55:37 +02:00
{% if item.value.ssl.stapling is defined and item.value.ssl.stapling %}
ssl_stapling on;
{% endif %}
{% if item.value.ssl.stapling_verify is defined and item.value.ssl.stapling_verify %}
ssl_stapling_verify on;
{% endif %}
2018-10-16 20:52:04 +02:00
{% endif %}
2019-07-17 13:32:47 +02:00
{% if item.value.include_files is defined and item.value.include_files | length %}
{% for file in item.value.include_files %}
include "{{ file }}";
{% endfor %}
{% endif %}
2019-07-15 14:49:10 +02:00
{% if item.value.proxy_hide_headers is defined %}
{% for header in item.value.proxy_hide_headers %}
proxy_hide_header {{ header }};
{% endfor %}
{% endif %}
2019-06-14 12:33:50 +02:00
{% if item.value.add_headers is defined %}
{% for header in item.value.add_headers %}
add_header {{ item.value.add_headers[header].name }} "{{ item.value.add_headers[header].value }}"{% if item.value.add_headers[header].always is defined and item.value.add_headers[header].always %} always{% endif %};
{% endfor %}
{% endif %}
2019-05-20 15:48:24 +02:00
{% if item.value.auth_basic is defined and item.value.auth_basic %}
auth_basic "{{ item.value.auth_basic }}";
{% endif %}
{% if item.value.auth_basic_user_file is defined and item.value.auth_basic_user_file %}
auth_basic_user_file {{ item.value.auth_basic_user_file }};
{% endif %}
2019-02-15 14:59:38 +01:00
{% if item.value.root is defined and item.value.root %}
root {{ item.value.root }};
2018-11-26 20:06:46 +01:00
{% endif %}
2019-01-14 17:26:37 +01:00
{% if item.value.https_redirect is defined and item.value.https_redirect %}
2019-06-08 20:15:21 +02:00
return 301 https://{% if item.value.server_name == "_" %}$host{% else %}{{ item.value.server_name }}{% endif %}$request_uri;
2019-02-15 14:59:38 +01:00
{% endif %}
{% if item.value.autoindex is defined and item.value.autoindex %}
autoindex on;
{% endif %}
2019-04-04 20:09:42 +02:00
{% if item.value.try_files is defined %}
try_files {{ item.value.try_files }};
{% endif %}
2019-04-18 11:51:44 +02:00
{% if item.value.auth_request is defined %}
auth_request {{ item.value.auth_request }};
{% endif %}
2019-07-12 20:14:46 +02:00
{% if item.value.auth_request_set is defined %}
auth_request_set {{ item.value.auth_request_set.name }} {{ item.value.auth_request_set.value }};
{% endif %}
2019-07-15 20:42:15 +02:00
{% if item.value.client_max_body_size is defined and item.value.client_max_body_size %}
client_max_body_size {{ item.value.client_max_body_size }};
{% endif %}
2019-04-18 11:51:44 +02:00
2019-05-21 17:23:06 +02:00
{% if item.value.reverse_proxy is defined and item.value.reverse_proxy %}
2019-01-14 17:26:37 +01:00
{% for location in item.value.reverse_proxy.locations %}
location {{ item.value.reverse_proxy.locations[location].location }} {
2019-04-18 11:51:44 +02:00
{% if item.value.reverse_proxy.locations[location].internal is sameas true %}
internal;
{% endif %}
2019-07-17 13:32:47 +02:00
{% if item.value.reverse_proxy.locations[location].include_files is defined and item.value.reverse_proxy.locations[location].include_files | length %}
{% for file in item.value.reverse_proxy.locations[location].include_files %}
include "{{ file }}";
{% endfor %}
{% endif %}
2019-07-15 14:49:10 +02:00
{% if item.value.reverse_proxy.locations[location].proxy_hide_headers is defined %}
{% for header in item.value.reverse_proxy.locations[location].proxy_hide_headers %}
proxy_hide_header {{ header }};
{% endfor %}
{% endif %}
2019-06-14 12:33:50 +02:00
{% if item.value.reverse_proxy.locations[location].add_headers is defined %}
{% for header in item.value.reverse_proxy.locations[location].add_headers %}
add_header {{ item.value.reverse_proxy.locations[location].add_headers[header].name }} "{{ item.value.reverse_proxy.locations[location].add_headers[header].value }}"{% if item.value.reverse_proxy.locations[location].add_headers[header].always is defined and item.value.reverse_proxy.locations[location].add_headers[header].always %} always{% endif %};
{% endfor %}
{% endif %}
2019-04-18 11:51:44 +02:00
{% if item.value.reverse_proxy.locations[location].auth_request is defined %}
auth_request {{ item.value.reverse_proxy.locations[location].auth_request }};
{% endif %}
2019-07-12 20:14:46 +02:00
{% if item.value.reverse_proxy.locations[location].auth_request_set is defined %}
auth_request_set {{ item.value.reverse_proxy.locations[location].auth_request_set.name }} {{ item.value.reverse_proxy.locations[location].auth_request_set.value }};
{% endif %}
2019-02-12 13:32:11 +01:00
{% if item.value.reverse_proxy.locations[location].auth_basic is defined and item.value.reverse_proxy.locations[location].auth_basic %}
auth_basic "{{ item.value.reverse_proxy.locations[location].auth_basic }}";
{% endif %}
2019-05-20 15:48:24 +02:00
{% if item.value.reverse_proxy.locations[location].auth_basic_user_file is defined and item.value.reverse_proxy.locations[location].auth_basic_user_file %}
auth_basic_user_file {{ item.value.reverse_proxy.locations[location].auth_basic_user_file }};
2019-03-07 21:34:22 +01:00
{% endif %}
2019-04-18 11:51:44 +02:00
{% if item.value.reverse_proxy.locations[location].returns is defined %}
{% for code in item.value.reverse_proxy.locations[location].returns %}
{% if item.value.reverse_proxy.locations[location].returns[code] is defined %}
return {{ item.value.reverse_proxy.locations[location].returns[code].code }} {{ item.value.reverse_proxy.locations[location].returns[code].url }};
{% else %}
return {{ item.value.reverse_proxy.locations[location].returns[code].url }};
{% endif %}
{% endfor %}
{% endif %}
2019-03-07 21:34:22 +01:00
{% if item.value.reverse_proxy.locations[location].proxy_connect_timeout is defined and item.value.reverse_proxy.locations[location].proxy_connect_timeout %}
proxy_connect_timeout {{ item.value.reverse_proxy.locations[location].proxy_connect_timeout }};
2019-02-12 13:32:11 +01:00
{% endif %}
2019-01-14 17:26:37 +01:00
proxy_pass {{ item.value.reverse_proxy.locations[location].proxy_pass }};
2019-07-26 23:21:34 +02:00
{% if item.value.reverse_proxy.locations[location].rewrite is defined %}
rewrite {{ item.value.reverse_proxy.locations[location].rewrite }};
{% endif %}
2019-03-07 21:34:22 +01:00
{% if item.value.reverse_proxy.locations[location].proxy_read_timeout is defined and item.value.reverse_proxy.locations[location].proxy_read_timeout %}
proxy_read_timeout {{ item.value.reverse_proxy.locations[location].proxy_read_timeout }};
{% endif %}
2019-04-18 11:51:44 +02:00
{% if item.value.reverse_proxy.locations[location].proxy_pass_request_body is defined %}
proxy_pass_request_body {{ item.value.reverse_proxy.locations[location].proxy_pass_request_body }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_store is defined %}
proxy_store {{ item.value.reverse_proxy.locations[location].proxy_store | ternary("on", "off") }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_store_access is defined %}
proxy_store_access {{ item.value.reverse_proxy.locations[location].proxy_store_access }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_set_header is defined %}
{% for header in item.value.reverse_proxy.locations[location].proxy_set_header %}
proxy_set_header {{ item.value.reverse_proxy.locations[location].proxy_set_header[header].name }} {{ item.value.reverse_proxy.locations[location].proxy_set_header[header].value }};
{% endfor %}
2019-07-12 19:59:25 +02:00
{% if item.value.reverse_proxy.locations[location].proxy_http_version is defined %}
proxy_http_version {{ item.value.reverse_proxy.locations[location].proxy_http_version }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].websocket is defined and item.value.reverse_proxy.locations[location].websocket %}
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
{% endif %}
2019-04-18 11:51:44 +02:00
{% endif %}
2019-04-04 20:09:42 +02:00
{% if item.value.reverse_proxy.locations[location].try_files is defined %}
try_files {{ item.value.reverse_proxy.locations[location].try_files }};
{% endif %}
2019-02-22 18:28:19 +01:00
2019-05-21 17:23:06 +02:00
{% if item.value.reverse_proxy.locations[location].proxy_ssl is defined and item.value.reverse_proxy.locations[location].proxy_ssl %}
2019-02-22 18:28:19 +01:00
{% if item.value.reverse_proxy.locations[location].proxy_ssl.cert is defined %}
proxy_ssl_certificate {{ item.value.reverse_proxy.locations[location].proxy_ssl.cert }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_ssl.key is defined %}
proxy_ssl_certificate_key {{ item.value.reverse_proxy.locations[location].proxy_ssl.key }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_ssl.trusted_cert is defined %}
proxy_ssl_trusted_certificate {{ item.value.reverse_proxy.locations[location].proxy_ssl.trusted_cert }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_ssl.server_name is defined %}
proxy_ssl_server_name {{ item.value.reverse_proxy.locations[location].proxy_ssl.server_name | ternary("on", "off") }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_ssl.name is defined %}
proxy_ssl_name {{ item.value.reverse_proxy.locations[location].proxy_ssl.name }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_ssl.protocols is defined %}
proxy_ssl_protocols {{ item.value.reverse_proxy.locations[location].proxy_ssl.protocols }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_ssl.ciphers is defined %}
proxy_ssl_ciphers {{ item.value.reverse_proxy.locations[location].proxy_ssl.ciphers }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_ssl.verify is defined %}
proxy_ssl_verify {{ item.value.reverse_proxy.locations[location].proxy_ssl.verify | ternary("on", "off") }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_ssl.verify_depth is defined %}
proxy_ssl_verify_depth {{ item.value.reverse_proxy.locations[location].proxy_ssl.verify_depth }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_ssl.session_reuse is defined %}
proxy_ssl_session_reuse {{ item.value.reverse_proxy.locations[location].proxy_ssl.session_reuse | ternary("on", "off") }};
{% endif %}
{% endif %}
2019-02-18 15:23:57 +01:00
{% if item.value.reverse_proxy.locations[location].proxy_redirect is defined %}
proxy_redirect {{ item.value.reverse_proxy.locations[location].proxy_redirect | ternary(item.value.reverse_proxy.locations[location].proxy_redirect, "off") }};
{% endif %}
2019-02-12 16:12:40 +01:00
{% if item.value.reverse_proxy.locations[location].proxy_cache is defined %}
proxy_cache {{ item.value.reverse_proxy.locations[location].proxy_cache }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_cache_background_update is defined %}
proxy_cache_background_update {{ item.value.reverse_proxy.locations[location].proxy_cache_background_update | ternary("on", "off") }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_cache_lock is defined %}
proxy_cache_lock {{ item.value.reverse_proxy.locations[location].proxy_cache_lock | ternary("on", "off") }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_cache_min_uses is defined %}
proxy_cache_min_uses {{ item.value.reverse_proxy.locations[location].proxy_cache_min_uses }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_cache_revalidate is defined %}
proxy_cache_revalidate {{ item.value.reverse_proxy.locations[location].proxy_cache_revalidate | ternary("on", "off") }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_cache_use_stale is defined %}
proxy_cache_use_stale {{ item.value.reverse_proxy.locations[location].proxy_cache_use_stale | join(" ") }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_temp_path is defined %}
proxy_temp_path {{ item.value.reverse_proxy.locations[location].proxy_temp_path.path }} {{ item.value.reverse_proxy.locations[location].proxy_temp_path.level_1 | default("") }} {{ item.value.reverse_proxy.locations[location].proxy_temp_path.level_2 | default("") }} {{ item.value.reverse_proxy.locations[location].proxy_temp_path.level_3 | default("") }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_ignore_headers is defined %}
proxy_ignore_headers {{ item.value.reverse_proxy.locations[location].proxy_ignore_headers | join(" ") }};
{% endif %}
2019-07-15 20:42:15 +02:00
{% if item.value.reverse_proxy.locations[location].client_max_body_size is defined and item.value.reverse_proxy.locations[location].client_max_body_size %}
client_max_body_size {{ item.value.reverse_proxy.locations[location].client_max_body_size }};
{% endif %}
2019-07-15 18:58:35 +02:00
{% if item.value.reverse_proxy.locations[location].proxy_cookie_path is defined %}
proxy_cookie_path {{ item.value.reverse_proxy.locations[location].proxy_cookie_path.path }} {{ item.value.reverse_proxy.locations[location].proxy_cookie_path.replacement }};
{% endif %}
2019-07-15 14:41:19 +02:00
{% if item.value.reverse_proxy.locations[location].proxy_buffering is defined %}
proxy_buffering {{ item.value.reverse_proxy.locations[location].proxy_buffering | ternary("on", "off") }};
{% endif %}
2019-02-12 16:12:40 +01:00
{% if (item.value.reverse_proxy.health_check_plus is defined) and item.value.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
2018-10-16 20:52:04 +02:00
{% if item.value.web_server is defined %}
2018-11-14 17:33:54 +01:00
{% for location in item.value.web_server.locations %}
location {{ item.value.web_server.locations[location].location }} {
2019-07-15 19:12:44 +02:00
{% if item.value.web_server.locations[location].html_file_location is defined %}
2018-11-14 17:33:54 +01:00
root {{ item.value.web_server.locations[location].html_file_location }};
2019-07-15 19:12:44 +02:00
{% endif %}
{% if item.value.web_server.locations[location].html_file_name is defined %}
2018-11-14 17:33:54 +01:00
index {{ item.value.web_server.locations[location].html_file_name }};
2019-07-15 19:12:44 +02:00
{% endif %}
{% if item.value.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-04-04 20:09:42 +02:00
{% if item.value.web_server.locations[location].try_files is defined %}
try_files {{ item.value.web_server.locations[location].try_files }};
{% endif %}
2019-07-17 13:32:47 +02:00
{% if item.value.web_server.locations[location].include_files is defined and item.value.web_server.locations[location].include_files | length %}
{% for file in item.value.web_server.locations[location].include_files %}
include "{{ file }}";
{% endfor %}
{% endif %}
2019-07-15 14:49:10 +02:00
{% if item.value.web_server.locations[location].proxy_hide_headers is defined %}
{% for header in item.value.web_server.locations[location].proxy_hide_headers %}
proxy_hide_header {{ header }};
{% endfor %}
{% endif %}
2019-06-14 12:33:50 +02:00
{% if item.value.web_server.locations[location].add_headers is defined %}
{% for header in item.value.web_server.locations[location].add_headers %}
add_header {{ item.value.web_server.locations[location].add_headers[header].name }} "{{ item.value.web_server.locations[location].add_headers[header].value }}"{% if item.value.web_server.locations[location].add_headers[header].always is defined and item.value.web_server.locations[location].add_headers[header].always %} always{% endif %};
{% endfor %}
{% endif %}
2019-04-18 11:51:44 +02:00
{% if item.value.web_server.locations[location].returns is defined %}
{% for code in item.value.web_server.locations[location].returns %}
{% if item.value.web_server.locations[location].returns[code] is defined %}
return {{ item.value.web_server.locations[location].returns[code].code }} {{ item.value.web_server.locations[location].returns[code].url }};
{% else %}
return {{ item.value.web_server.locations[location].returns[code].url }};
{% endif %}
{% endfor %}
{% endif %}
2019-02-12 13:32:11 +01:00
{% if item.value.web_server.locations[location].auth_basic is defined and item.value.web_server.locations[location].auth_basic %}
auth_basic "{{ item.value.web_server.locations[location].auth_basic }}";
{% endif %}
2019-05-20 15:48:24 +02:00
{% if item.value.web_server.locations[location].auth_basic_user_file is defined and item.value.web_server.locations[location].auth_basic_user_file %}
auth_basic_user_file {{ item.value.web_server.locations[location].auth_basic_user_file }};
2019-04-18 11:51:44 +02:00
{% endif %}
{% if item.value.web_server.locations[location].auth_request is defined %}
auth_request {{ item.value.web_server.locations[location].auth_request }};
2018-11-26 20:06:46 +01:00
{% endif %}
2019-07-12 20:14:46 +02:00
{% if item.value.web_server.locations[location].auth_request_set is defined %}
auth_request_set {{ item.value.web_server.locations[location].auth_request_set.name }} {{ item.value.web_server.locations[location].auth_request_set.value }};
{% endif %}
2018-10-16 20:52:04 +02:00
}
2018-11-14 17:33:54 +01:00
{% endfor %}
2018-10-16 20:52:04 +02:00
{% if item.value.web_server.http_demo_conf %}
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-07-17 14:10:09 +02:00
{% if item.value.returns is defined %}
{% for return in item.value.returns %}
location {{ item.value.returns[return].location }} {
return {{ item.value.returns[return].code }}{% if item.value.returns[return].value is defined %} {{ item.value.returns[return].value }}{% endif %};
}
{% endfor %}
{% endif %}
2018-10-16 20:52:04 +02:00
{% if item.value.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 {
2018-10-16 20:52:04 +02:00
root {{ item.value.error_page }};
2018-01-26 20:00:26 +01:00
}
2018-10-16 20:52:04 +02:00
{% endif %}
2019-05-21 17:23:06 +02:00
}