在使用logrotate對(duì)nginx的日志進(jìn)行分割的時(shí)候系統(tǒng)報(bào)錯(cuò),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.
提示沒(méi)有權(quán)限訪問(wèn)nginx/access.log,看過(guò)其他人遇到的情況贞远,處理辦法是在/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
}
但是實(shí)際并沒(méi)有解決我的問(wèn)題暂刘,然后其實(shí)通過(guò)修改權(quán)限的方式解決問(wèn)題的如贷,修改為:
drwx------+? 2 nginx? nginx? ? ? ? ? ? ? 4096 Mar 22 09:16 nginx
希望有幫助