原来nginx默认安装时,会在/ect/logrotate.d/下增加nginx配置
vim /ect/logrotate.d/nginx
/data/logs/nginx/*log { daily rotate 10 missingok notifempty compress sharedscripts postrotate /etc/init.d/nginx reopen_logs endscript }
执行 /etc/init.d/nginx reopen_logs 发现执行失败。
将该命令替换为
[ ! -f /usr/local/nginx/logs/nginx.pid ] || kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`
其中/usr/local/nginx/logs/nginx.pid 为nginx.conf中配置的pid存放地址。
该问题解决。