added logs rotation

This commit is contained in:
2025-07-30 12:20:05 +02:00
parent 7c66e29dd3
commit 04fda43862
3 changed files with 23 additions and 3 deletions

View File

@@ -128,5 +128,24 @@ touch /app/htpasswd
mkdir -p /data/logs
chown -R "${USERNAME}" /data/logs
# configure logrotate
LOG_DAYS=${LOG_DAYS:-7}
cat >/etc/logrotate.d/nginx <<EOF
/data/logs/nginx-access.log {
missingok
daily
rotate ${LOG_DAYS}
compress
delaycompress
sharedscripts
su ${USERNAME} ${GROUPNAME}
postrotate
/usr/sbin/nginx -s reopen
endscript
}
EOF
crond -b
# start nginx
echo starting nginx
nginx