added logs rotation
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user