# Access\_log and error\_log ownership

**URL:** <https://www.ruby-forum.com/t/access-log-and-error-log-ownership/217753>\
**Category:** NGINX\
**Created:** [March 11, 2012, 5:19pm UTC](https://www.ruby-forum.com/t/access-log-and-error-log-ownership/217753 "2012-03-11T17:19:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [March 11, 2012, 5:19pm UTC](https://www.ruby-forum.com/t/access-log-and-error-log-ownership/217753/1 "2012-03-11T17:19:38Z")

</div>

Hello,

I noticed the following behavior.

1. stop nginx (/etc/init.d/nginx stop on a debian box)
2. remove all logs in /var/log/nginx/
3. start nginx

now /var/log/nginx/access.log and /var/log/nginx/error.log are owned by  
root:root.

in fact it’s the same for all other vhosts log files.

1. issue kill -USR1 `cat /var/run/nginx.pid`

now /var/log/nginx/access.log and /var/log/nginx/error.log are owned by  
www-data:root, where www-data is nginx’s user as per  
/etc/nginx/nginx.conf  
configuration file.

same for all vhosts log files.

Why is it so?

Gregory

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 11, 2012, 6:04pm UTC](https://www.ruby-forum.com/t/access-log-and-error-log-ownership/217753/2 "2012-03-11T18:04:33Z")

</div>

Hello!

On Sun, Mar 11, 2012 at 05:18:39PM +0100, Grégory Pakosz wrote:

> Why is it so?  
> When reopening log files nginx has to do this from inside worker  
> processes, and to be able to do so it chown’s them to a user under  
> which nginx worker processes are running.

Maxim D.
