Home  >  Q&A  >  body text

How to specify the permissions of log files in nginx?

The thing originated from such a scene:

nginxRun 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.

大家讲道理大家讲道理2713 days ago1082

reply all(2)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-16 17:23:43

    Don’t use the chmod command to modify file permissions? This way other users can read it.

    reply
    0
  • 给我你的怀抱

    给我你的怀抱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

    reply
    0
  • Cancelreply