File tree Expand file tree Collapse file tree 5 files changed +67
-13
lines changed Expand file tree Collapse file tree 5 files changed +67
-13
lines changed Original file line number Diff line number Diff line change @@ -336,10 +336,21 @@ nginx_main_template:
336
336
user : nginx
337
337
worker_processes : auto
338
338
# worker_rlimit_nofile: 1024
339
- error_level : warn
339
+ error_log :
340
+ location : /var/log/nginx/error.log
341
+ level : warn
340
342
worker_connections : 1024
341
343
http_enable : true
342
344
http_settings :
345
+ access_log_format :
346
+ - name : main
347
+ format : |-
348
+ '$remote_addr - $remote_user [$time_local] "$request" '
349
+ '$status $body_bytes_sent "$http_referer" '
350
+ '"$http_user_agent" "$http_x_forwarded_for"'
351
+ access_log_location :
352
+ - name : main
353
+ location : /var/log/nginx/access.log
343
354
keepalive_timeout : 65
344
355
cache : false
345
356
rate_limit : false
@@ -368,6 +379,12 @@ nginx_http_template:
368
379
server_name : localhost
369
380
include_files : []
370
381
error_page : /usr/share/nginx/html
382
+ access_log :
383
+ - name : main
384
+ location : /var/log/nginx/access.log
385
+ error_log :
386
+ location : /var/log/nginx/error.log
387
+ level : warn
371
388
root : /usr/share/nginx/html
372
389
https_redirect : false
373
390
autoindex : false
@@ -472,9 +489,9 @@ nginx_http_template:
472
489
# rewrite: /foo(.*) /$1 break
473
490
# proxy_pass_request_body: off
474
491
# allows:
475
- # - 192.168.1.0/24
492
+ # - 192.168.1.0/24
476
493
# denies:
477
- # - all
494
+ # - all
478
495
proxy_set_header :
479
496
header_host :
480
497
name : Host
@@ -566,9 +583,6 @@ nginx_http_template:
566
583
location : /
567
584
code : 301
568
585
value : http://$host$request_uri
569
- return404 :
570
- location : /setup
571
- code : 404
572
586
573
587
# Enable NGINX status data.
574
588
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
Original file line number Diff line number Diff line change @@ -147,10 +147,21 @@ nginx_main_template:
147
147
user : nginx
148
148
worker_processes : auto
149
149
# worker_rlimit_nofile: 1024
150
- error_level : warn
150
+ error_log :
151
+ location : /var/log/nginx/error.log
152
+ level : warn
151
153
worker_connections : 1024
152
154
http_enable : true
153
155
http_settings :
156
+ access_log_format :
157
+ - name : main
158
+ format : |-
159
+ '$remote_addr - $remote_user [$time_local] "$request" '
160
+ '$status $body_bytes_sent "$http_referer" '
161
+ '"$http_user_agent" "$http_x_forwarded_for"'
162
+ access_log_location :
163
+ - name : main
164
+ location : /var/log/nginx/access.log
154
165
keepalive_timeout : 65
155
166
cache : false
156
167
rate_limit : false
@@ -179,6 +190,12 @@ nginx_http_template:
179
190
server_name : localhost
180
191
include_files : []
181
192
error_page : /usr/share/nginx/html
193
+ access_log :
194
+ - name : main
195
+ location : /var/log/nginx/access.log
196
+ error_log :
197
+ location : /var/log/nginx/error.log
198
+ level : warn
182
199
root : /usr/share/nginx/html
183
200
https_redirect : false
184
201
autoindex : false
Original file line number Diff line number Diff line change 13
13
conf_file_location : /etc/nginx/
14
14
user : nginx
15
15
worker_processes : auto
16
- error_level : warn
16
+ error_log :
17
+ location : /var/log/nginx/error.log
18
+ level : warn
17
19
worker_connections : 1024
18
20
http_enable : true
19
21
http_settings :
22
+ access_log_format :
23
+ - name : main
24
+ format : |
25
+ '$remote_addr - $remote_user [$time_local] "$request" '
26
+ '$status $body_bytes_sent "$http_referer" '
27
+ '"$http_user_agent" "$http_x_forwarded_for"'
28
+ access_log_location :
29
+ - name : main
30
+ location : /var/log/nginx/access.log
20
31
keepalive_timeout : 65
21
32
cache : false
22
33
rate_limit : false
Original file line number Diff line number Diff line change @@ -380,4 +380,14 @@ server {
380
380
root {{ item.value.error_page }};
381
381
}
382
382
{% endif %}
383
+
384
+ {% if item .value .access_log is defined %}
385
+ {% for access_log in item .value .access_log %}
386
+ access_log {{ access_log.location }} {{ access_log.name }};
387
+ {% endfor %}
388
+ {% endif %}
389
+ {% if item .value .error_log is defined %}
390
+ error_log {{ item.value.error_log.location }} {{ item.value.error_log.level }};
391
+ {% endif %}
392
+
383
393
}
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ worker_processes {{ nginx_main_template.worker_processes }};
38
38
worker_rlimit_nofile {{ nginx_main_template.worker_rlimit_nofile }};
39
39
{% endif %}
40
40
41
- error_log /var/log/nginx/error.log {{ nginx_main_template.error_level }};
41
+ error_log {{ nginx_main_template.error_log.location }} {{ nginx_main_template.error_log.level }};
42
42
pid /var/run/nginx.pid;
43
43
44
44
@@ -51,11 +51,13 @@ http {
51
51
include /etc/nginx/mime.types;
52
52
default_type application/octet-stream;
53
53
54
- log_format main '$remote_addr - $remote_user [$time_local] "$request" '
55
- '$status $body_bytes_sent "$http_referer" '
56
- '"$http_user_agent" "$http_x_forwarded_for"';
54
+ {% for access_log in nginx_main_template . http_settings . access_log_format %}
55
+ log_format {{ access_log.name }} {{ access_log.format }};
56
+ {% endfor %}
57
57
58
- access_log /var/log/nginx/access.log main;
58
+ {% for access_log in nginx_main_template .http_settings .access_log_location %}
59
+ access_log {{ access_log.location }} {{ access_log.name }};
60
+ {% endfor %}
59
61
60
62
sendfile on;
61
63
#tcp_nopush on;
You can’t perform that action at this time.
0 commit comments