@@ -6,9 +6,12 @@ load_module {{ nginx_module }};
6
6
{% endfor %}
7
7
{% endif %}
8
8
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 %}
12
15
{% if nginx_config_main_template .worker_rlimit_nofile is defined %}
13
16
worker_rlimit_nofile {{ nginx_config_main_template.worker_rlimit_nofile }};
14
17
{% endif %}
@@ -19,12 +22,17 @@ worker_rlimit_nofile {{ nginx_config_main_template.worker_rlimit_nofile }};
19
22
{% endfor %}
20
23
{% endif %}
21
24
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 %}
25
31
26
32
events {
33
+ {% if nginx_config_main_template .worker_connections is defined %}
27
34
worker_connections {{ nginx_config_main_template.worker_connections }};
35
+ {% endif %}
28
36
{% if nginx_config_main_template .events_custom_options is defined and nginx_config_main_template .events_custom_options | length %}
29
37
{% for inline_option in nginx_config_main_template .events_custom_options %}
30
38
{{ inline_option }}
@@ -36,7 +44,6 @@ events {
36
44
http {
37
45
include /etc/nginx/mime.types;
38
46
default_type application/octet-stream;
39
-
40
47
{% if nginx_config_main_template .http_settings .app_protect_global is defined %}
41
48
{% from 'http/app_protect.j2' import app_protect_global with context %}
42
49
{% filter indent (4) %}
67
74
{% endfor %}
68
75
{% endif %}
69
76
{% 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 %}
71
80
{% if nginx_config_main_template .http_settings .tcp_nopush is defined and nginx_config_main_template .http_settings .tcp_nopush %}
72
81
tcp_nopush on;
73
82
{% endif %}
@@ -125,7 +134,7 @@ http {
125
134
}
126
135
{% endif %}
127
136
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 %}
129
138
stream {
130
139
{% if nginx_config_main_template .stream_custom_options is defined and nginx_config_main_template .stream_custom_options | length %}
131
140
{% for inline_option in nginx_config_main_template .stream_custom_options %}
0 commit comments