2019-02-22 17:48:17 +01:00
|
|
|
{{ ansible_managed | comment }}
|
2019-01-03 23:13:56 +01:00
|
|
|
|
2019-08-03 12:53:21 +02:00
|
|
|
{% if nginx_modules.njs %}
|
|
|
|
{% if nginx_http_template_enable %}
|
|
|
|
load_module modules/ngx_http_js_module.so;
|
|
|
|
{% endif %}
|
|
|
|
{% if nginx_stream_template_enable %}
|
|
|
|
load_module modules/ngx_stream_js_module.so;
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% if nginx_modules.perl %}
|
|
|
|
load_module modules/ngx_http_perl_module.so;
|
|
|
|
{% endif %}
|
|
|
|
{% if nginx_modules.geoip %}
|
|
|
|
{% if nginx_http_template_enable %}
|
|
|
|
load_module modules/ngx_http_geoip_module.so;
|
|
|
|
{% endif %}
|
|
|
|
{% if nginx_stream_template_enable %}
|
|
|
|
load_module modules/ngx_stream_geoip_module.so;
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% if nginx_modules.image_filter %}
|
|
|
|
load_module modules/ngx_http_image_filter_module.so;
|
|
|
|
{% endif %}
|
|
|
|
{% if nginx_modules.rtmp and nginx_type == "plus" %}
|
|
|
|
load_module modules/ngx_rtmp_module.so;
|
|
|
|
{% endif %}
|
|
|
|
{% if nginx_modules.xslt %}
|
|
|
|
load_module modules/ngx_http_xslt_filter_module.so;
|
|
|
|
{% endif %}
|
|
|
|
{% if nginx_modules.waf and nginx_type == "plus" %}
|
|
|
|
load_module modules/ngx_http_modsecurity_module.so;
|
|
|
|
{% endif %}
|
2018-10-16 20:52:04 +02:00
|
|
|
user {{ nginx_main_template.user }};
|
|
|
|
worker_processes {{ nginx_main_template.worker_processes }};
|
2018-01-26 20:00:26 +01:00
|
|
|
|
2019-08-23 16:00:20 +02:00
|
|
|
{% if nginx_main_template.worker_rlimit_nofile is defined %}
|
|
|
|
worker_rlimit_nofile {{ nginx_main_template.worker_rlimit_nofile }};
|
|
|
|
{% endif %}
|
|
|
|
|
2019-10-20 17:52:56 +02:00
|
|
|
{% if nginx_main_template.custom_options is defined and nginx_main_template.custom_options | length %}
|
|
|
|
{% for inline_option in nginx_main_template.custom_options %}
|
2020-06-09 18:23:38 +02:00
|
|
|
{{ inline_option }}
|
2019-10-20 17:52:56 +02:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
2019-10-02 19:29:59 +02:00
|
|
|
error_log {{ nginx_main_template.error_log.location }} {{ nginx_main_template.error_log.level }};
|
2018-01-26 20:00:26 +01:00
|
|
|
pid /var/run/nginx.pid;
|
|
|
|
|
|
|
|
|
|
|
|
events {
|
2018-10-16 20:52:04 +02:00
|
|
|
worker_connections {{ nginx_main_template.worker_connections }};
|
2019-10-20 17:52:56 +02:00
|
|
|
{% if nginx_main_template.events_custom_options is defined and nginx_main_template.events_custom_options | length %}
|
|
|
|
{% for inline_option in nginx_main_template.events_custom_options %}
|
2020-06-09 18:23:38 +02:00
|
|
|
{{ inline_option }}
|
2019-10-20 17:52:56 +02:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2018-01-26 20:00:26 +01:00
|
|
|
}
|
|
|
|
|
2018-10-16 20:52:04 +02:00
|
|
|
{% if nginx_main_template.http_enable %}
|
2018-01-26 20:00:26 +01:00
|
|
|
http {
|
|
|
|
include /etc/nginx/mime.types;
|
|
|
|
default_type application/octet-stream;
|
|
|
|
|
2019-10-02 19:29:59 +02:00
|
|
|
{% for access_log in nginx_main_template.http_settings.access_log_format %}
|
|
|
|
log_format {{ access_log.name }} {{ access_log.format }};
|
|
|
|
{% endfor %}
|
2018-01-26 20:00:26 +01:00
|
|
|
|
2019-10-02 19:29:59 +02:00
|
|
|
{% for access_log in nginx_main_template.http_settings.access_log_location %}
|
|
|
|
access_log {{ access_log.location }} {{ access_log.name }};
|
|
|
|
{% endfor %}
|
2018-01-26 20:00:26 +01:00
|
|
|
|
|
|
|
sendfile on;
|
2019-11-26 14:14:46 +01:00
|
|
|
|
2019-11-26 14:30:05 +01:00
|
|
|
{% if nginx_main_template.http_settings.tcp_nopush is defined and nginx_main_template.http_settings.tcp_nopush %}
|
2019-11-26 14:14:46 +01:00
|
|
|
tcp_nopush on;
|
|
|
|
{% endif %}
|
2019-11-26 14:30:05 +01:00
|
|
|
{% if nginx_main_template.http_settings.tcp_nodelay is defined and nginx_main_template.http_settings.tcp_nodelay %}
|
2019-11-26 14:14:46 +01:00
|
|
|
tcp_nodelay on;
|
|
|
|
{% endif %}
|
2018-01-26 20:00:26 +01:00
|
|
|
|
2019-10-25 11:16:03 +02:00
|
|
|
{% if nginx_main_template.http_settings.server_tokens is defined and nginx_main_template.http_settings.server_tokens | length %}
|
|
|
|
server_tokens {{ nginx_main_template.http_settings.server_tokens }};
|
|
|
|
{% endif %}
|
|
|
|
|
2018-10-16 20:52:04 +02:00
|
|
|
keepalive_timeout {{ nginx_main_template.http_settings.keepalive_timeout }};
|
2018-01-26 20:00:26 +01:00
|
|
|
|
|
|
|
#gzip on;
|
2018-10-16 20:52:04 +02:00
|
|
|
{% if nginx_main_template.http_settings.cache %}
|
|
|
|
proxy_cache_path /tmp/cache keys_zone=one:10m;
|
|
|
|
{% endif %}
|
|
|
|
{% if nginx_main_template.http_settings.rate_limit %}
|
|
|
|
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;
|
|
|
|
{% endif %}
|
|
|
|
{% if nginx_main_template.http_settings.keyval %}
|
|
|
|
keyval_zone zone={{nginx_main_template.http_settings.keyval.zone}}:32k state=one.keyval;
|
|
|
|
keyval $arg_text $text zone=one;
|
2018-11-26 20:06:46 +01:00
|
|
|
{% endif %}
|
2019-07-15 19:12:44 +02:00
|
|
|
{% if nginx_main_template.http_global_autoindex | default(false) %}
|
2018-11-26 20:06:46 +01:00
|
|
|
autoindex on;
|
2019-10-20 17:52:56 +02:00
|
|
|
{% endif %}
|
2020-02-15 00:54:31 +01:00
|
|
|
{% if nginx_main_template.sub_filter.sub_filters is defined and nginx_main_template.sub_filter.sub_filters | length %}
|
|
|
|
{% for sub_filter in nginx_main_template.sub_filter.sub_filters %}
|
|
|
|
sub_filter {{ sub_filter }};
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
{% if nginx_main_template.sub_filter.last_modified is defined %}
|
|
|
|
sub_filter_last_modified {{ nginx_main_template.sub_filter.last_modified | ternary("on", "off") }};
|
|
|
|
{% endif %}
|
|
|
|
{% if nginx_main_template.sub_filter.once is defined %}
|
|
|
|
sub_filter_once {{ nginx_main_template.sub_filter.once | ternary("on", "off") }};
|
|
|
|
{% endif %}
|
|
|
|
{% if nginx_main_template.sub_filter.types is defined and nginx_main_template.sub_filter.types %}
|
|
|
|
sub_filter_types {{ nginx_main_template.sub_filter.types }};
|
|
|
|
{% endif %}
|
2019-10-20 17:52:56 +02:00
|
|
|
{% if nginx_main_template.http_custom_options is defined and nginx_main_template.http_custom_options | length %}
|
|
|
|
{% for inline_option in nginx_main_template.http_custom_options %}
|
2020-06-09 18:23:38 +02:00
|
|
|
{{ inline_option }}
|
2019-10-20 17:52:56 +02:00
|
|
|
{% endfor %}
|
2018-10-16 20:52:04 +02:00
|
|
|
{% endif %}
|
|
|
|
include /etc/nginx/conf.d/*.conf;
|
2020-06-23 12:45:05 +02:00
|
|
|
{% if nginx_main_template.http_custom_includes is defined and nginx_main_template.http_custom_includes | length %}
|
|
|
|
{% for inline_include in nginx_main_template.http_custom_includes %}
|
|
|
|
include {{ inline_option }};
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2018-02-20 21:28:14 +01:00
|
|
|
}
|
|
|
|
{% endif %}
|
|
|
|
|
2018-10-16 20:52:04 +02:00
|
|
|
{% if nginx_main_template.stream_enable %}
|
2018-02-20 21:28:14 +01:00
|
|
|
stream {
|
2019-10-20 17:52:56 +02:00
|
|
|
{% if nginx_main_template.stream_custom_options is defined and nginx_main_template.stream_custom_options | length %}
|
|
|
|
{% for inline_option in nginx_main_template.stream_custom_options %}
|
2020-06-09 18:23:38 +02:00
|
|
|
{{ inline_option }}
|
2019-10-20 17:52:56 +02:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2018-02-20 21:28:14 +01:00
|
|
|
include /etc/nginx/conf.d/stream/*.conf;
|
2018-01-26 20:00:26 +01:00
|
|
|
}
|
2018-02-20 21:28:14 +01:00
|
|
|
{% endif %}
|