@@ -6,9 +6,12 @@ load_module {{ nginx_module }};
66{% endfor %}
77{% endif %}
88
9- user {{ nginx_config_main_template.user }};
10- worker_processes {{ nginx_config_main_template.worker_processes }};
11-
9+ {% if nginx_config_main_template .user is defined %}
10+ user {{ nginx_config_main_template.user }};
11+ {% endif %}
12+ {% if nginx_config_main_template .worker_processes is defined %}
13+ worker_processes {{ nginx_config_main_template.worker_processes }};
14+ {% endif %}
1215{% if nginx_config_main_template .worker_rlimit_nofile is defined %}
1316worker_rlimit_nofile {{ nginx_config_main_template.worker_rlimit_nofile }};
1417{% endif %}
@@ -19,12 +22,17 @@ worker_rlimit_nofile {{ nginx_config_main_template.worker_rlimit_nofile }};
1922{% endfor %}
2023{% endif %}
2124
22- error_log {{ nginx_config_main_template.error_log.location | default("/var/log/nginx/error.log") }} {{ nginx_config_main_template.error_log.level | default("warn") }};
23- pid {{ nginx_config_main_template.pid | default("/var/run/nginx.pid") }};
24-
25+ {% if nginx_config_main_template .error_log is defined %}
26+ error_log {{ nginx_config_main_template.error_log.location }} {{ nginx_config_main_template.error_log.level }};
27+ {% endif %}
28+ {% if nginx_config_main_template .pid is defined %}
29+ pid {{ nginx_config_main_template.pid }};
30+ {% endif %}
2531
2632events {
33+ {% if nginx_config_main_template .worker_connections is defined %}
2734 worker_connections {{ nginx_config_main_template.worker_connections }};
35+ {% endif %}
2836{% if nginx_config_main_template .events_custom_options is defined and nginx_config_main_template .events_custom_options | length %}
2937{% for inline_option in nginx_config_main_template .events_custom_options %}
3038 {{ inline_option }}
@@ -36,7 +44,6 @@ events {
3644http {
3745 include /etc/nginx/mime.types;
3846 default_type application/octet-stream;
39-
4047{% if nginx_config_main_template .http_settings .app_protect_global is defined %}
4148{% from 'http/app_protect.j2' import app_protect_global with context %}
4249{% filter indent (4) %}
6774{% endfor %}
6875{% endif %}
6976{% endif %}
70- sendfile on;
77+ {% if nginx_config_main_template .http_settings .sendfile is defined and nginx_config_main_template .http_settings .sendfile %}
78+ sendfile on;
79+ {% endif %}
7180{% if nginx_config_main_template .http_settings .tcp_nopush is defined and nginx_config_main_template .http_settings .tcp_nopush %}
7281 tcp_nopush on;
7382{% endif %}
@@ -125,7 +134,7 @@ http {
125134}
126135{% endif %}
127136
128- {% if nginx_config_main_template .stream_enable %}
137+ {% if nginx_config_main_template .stream_enable is defined and nginx_config_main_template . stream_enable %}
129138stream {
130139{% if nginx_config_main_template .stream_custom_options is defined and nginx_config_main_template .stream_custom_options | length %}
131140{% for inline_option in nginx_config_main_template .stream_custom_options %}
0 commit comments