Welcome! Log In Create A New Profile


logfiles group ownership

December 15, 2009 07:59AM
I am running nginx-0.7.64 and my nginx.conf includes "user nginx nginx;"

If I rotate logfiles and send SIGUSR1, new logfiles are created owned by user=nginx group=root (rather than group=nginx as I had expected).

I looked at the source and I think that the problem is in ngx_file.c:

ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user)
// ...
if (fi.st_uid != user) {
if (chown((const char *) path[i]->name.data, user, -1) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
"chown(\"%s\", %d) failed",
path[i]->name.data, user);
return NGX_ERROR;
// ...

Unfortunately, no group information is passed to this function, so logfiles are created with the effective(?) gid of the master process (often root).

Depending on your OS, a work-around may be possible by adding a "create" line to /etc/lograte.d/nginx, and then setting the group permissions manually (/bin/chgrp) on the log-files.
Subject Author Posted

logfiles group ownership

robtinsley December 15, 2009 07:59AM

Re: logfiles group ownership

Igor Sysoev December 15, 2009 11:58AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 70
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready