-
Notifications
You must be signed in to change notification settings - Fork 1
/
nginx
36 lines (30 loc) · 1005 Bytes
/
nginx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/var/log/nginx/*.log /var/log/nginx/*/*.log {
# Compress using better compression algorithm
compress
compresscmd /usr/bin/xz
uncompresscmd /usr/bin/unxz
compressoptions -9
# ...but leave the last one
delaycompress
# Rotate daily
daily
# If the file is missing, this is not an error
missingok
# Keep logs forever
rotate 365000
# Add a date to the file instead of serial numbers
dateext
dateformat -%Y-%m-%d
# Recreate the log files
create 0640 nginx nginx
# Execute POST/PRE rotate scripts only once for all files
sharedscripts
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate;
fi;
endscript
postrotate
[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
endscript
}