在使用logrotate对nginx的日志进行分割的时候系统报错,error信息:
error: skipping "/var/log/nginx/access.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
提示没有权限访问nginx/access.log,看过其他人遇到的情况,处理办法是在/etc/logrotate.d/nginx文件中添su root list,添加后的nginx文件:
/var/log/nginx/*.log {
su root list
daily
missingok
rotate 52
compress
delaycompress
notifempty
#ifempty
create 0640 www-data adm
sharedscripts
postrotate
[ ! -f/var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
endscript
}
但是实际并没有解决我的问题,然后其实通过修改权限的方式解决问题的,修改为:
drwx------+ 2 nginx nginx 4096 Mar 22 09:16 nginx
希望有帮助
网友评论