The thing originated from such a scene:
nginx
Run as user _www
, the permissions of log files access.log
and so on are:
_www _www rw------ -
And I now need to let another user read the file, so I want to be able to specify the permissions of the log file. After searching, I didn't find that nginx
provides this configuration, and I was very confused.
Please give me some advice.
phpcn_u15822017-05-16 17:23:43
Don’t use the chmod command to modify file permissions? This way other users can read it.
给我你的怀抱2017-05-16 17:23:43
cat /etc/logrotate.d/nginx
/var/log/nginx/*.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 644 nginx root
sharedscripts
postrotate
[ -f /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid`
endscript
}
Change the log rolling configuration