分割日志时报错:

:error: skipping "/var/log/nginx/test.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.

xx 文件所属用户

添加“su root xx”到/etc/logrotate.d/nginx文件中即可
如下;

/var/log/nginx/*.log {
        su root public
        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
}