fix: nginx log rotation
This commit is contained in:
parent
bd4dc157b8
commit
1e7f05a29e
27
roles/nginx/templates/logrotate-nginx.j2
Normal file
27
roles/nginx/templates/logrotate-nginx.j2
Normal file
@ -0,0 +1,27 @@
|
||||
# Logrotate configuration for nginx
|
||||
# Managed by Ansible - DO NOT EDIT MANUALLY
|
||||
|
||||
/var/log/nginx/*.log {
|
||||
{{ nginx_logrotate_frequency }}
|
||||
missingok
|
||||
rotate {{ nginx_logrotate_rotate }}
|
||||
{% if nginx_logrotate_compress %}
|
||||
compress
|
||||
delaycompress
|
||||
{% endif %}
|
||||
notifempty
|
||||
create 0640 {{ nginx_user }} adm
|
||||
sharedscripts
|
||||
prerotate
|
||||
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
|
||||
run-parts /etc/logrotate.d/httpd-prerotate; \
|
||||
fi
|
||||
endscript
|
||||
postrotate
|
||||
# Test config before reload
|
||||
nginx -t > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
systemctl reload nginx > /dev/null 2>&1 || true
|
||||
fi
|
||||
endscript
|
||||
}
|
||||
2
roles/nginx/vars/debian.yml
Normal file
2
roles/nginx/vars/debian.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
nginx_user: www-data
|
||||
Loading…
Reference in New Issue
Block a user