# Nginx using access.log.1 after using a logrotate script under ubuntu (from source)

**URL:** <https://www.ruby-forum.com/t/nginx-using-access-log-1-after-using-a-logrotate-script-under-ubuntu-from-source/184706>\
**Category:** NGINX\
**Created:** [March 7, 2010, 3:13am UTC](https://www.ruby-forum.com/t/nginx-using-access-log-1-after-using-a-logrotate-script-under-ubuntu-from-source/184706 "2010-03-07T03:13:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pablo\_platt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/d6d6ee/32.png) [@pablo\_platt](https://www.ruby-forum.com/u/pablo_platt)\
**Post date:** [March 7, 2010, 3:13am UTC](https://www.ruby-forum.com/t/nginx-using-access-log-1-after-using-a-logrotate-script-under-ubuntu-from-source/184706/1 "2010-03-07T03:13:59Z")

</div>

Hi

I’ve built nginx from source on ubuntu in /usr/local/nginx according to  
the  
tutorial:  
[http://articles.slicehost.com/2009/3/4/ubuntu-intrepid-installing-nginx-from-source](http://articles.slicehost.com/2009/3/4/ubuntu-intrepid-installing-nginx-from-source)

and used the init.d script:  
[http://articles.slicehost.com/2009/3/4/ubuntu-intrepid-adding-an-nginx-init-script](http://articles.slicehost.com/2009/3/4/ubuntu-intrepid-adding-an-nginx-init-script)

read this about nginx log rotation:  
[http://www.ruby-forum.com/topic/134115](http://www.ruby-forum.com/topic/134115)

when forcing logrotate with: sudo logrotate -f /etc/logrotate.conf  
nginx starts using access.log.1  
but when using a signal manually nginx uses access.log: sudo kill -USR1  
`cat nginx.pid`

If I’m using ‘nginx’ user in the logrotate script I’m getting an error  
that  
this use doesn’t exists so I have to use root.  
My logrotate script under /etc/logrotate.d/nginx  
/usr/local/nginx/logs/\*.log {  
weekly  
missingok  
rotate 52  
compress  
delaycompress  
notifempty  
create 640 nginx adm  
sharedscripts  
postrotate  
[! -f /usr/local/nginx/logs/nginx.pid] || kill -USR1  
`cat /usr/local/nginx/logs/nginx.pid`  
endscript  
}

What am I doing wrong?  
Thanks

---

<div class="post-metadata">

**Author:** ![pablo\_platt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/d6d6ee/32.png) [@pablo\_platt](https://www.ruby-forum.com/u/pablo_platt)\
**Post date:** [March 7, 2010, 3:18am UTC](https://www.ruby-forum.com/t/nginx-using-access-log-1-after-using-a-logrotate-script-under-ubuntu-from-source/184706/2 "2010-03-07T03:18:40Z")

</div>

Maybe you used a tooooooooooold version?  
Try the current!

On Sun, Mar 7, 2010 at 10:13 AM, pablo platt [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi
> 
> I’ve built nginx from source on ubuntu in /usr/local/nginx according to the  
> tutorial:  
> [http://articles.slicehost.com/2009/3/4/ubuntu-intrepid-installing-nginx-from-source](http://articles.slicehost.com/2009/3/4/ubuntu-intrepid-installing-nginx-from-source)

–  
Ren Xiaolei

---

<div class="post-metadata">

**Author:** ![pablo\_platt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/d6d6ee/32.png) [@pablo\_platt](https://www.ruby-forum.com/u/pablo_platt)\
**Post date:** [March 7, 2010, 6:17am UTC](https://www.ruby-forum.com/t/nginx-using-access-log-1-after-using-a-logrotate-script-under-ubuntu-from-source/184706/3 "2010-03-07T06:17:12Z")

</div>

Are you sure, that /usr/local/nginx/logs/nginx.pid has actual pid of  
the master process?

2010/3/7 pablo platt [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![pablo\_platt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/d6d6ee/32.png) [@pablo\_platt](https://www.ruby-forum.com/u/pablo_platt)\
**Post date:** [March 7, 2010, 9:16am UTC](https://www.ruby-forum.com/t/nginx-using-access-log-1-after-using-a-logrotate-script-under-ubuntu-from-source/184706/4 "2010-03-07T09:16:17Z")

</div>

2010/3/7 Ð‘Ð¾Ñ€Ð¸Ñ Ð”Ð¾Ð»Ð³Ð¾Ð² [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> Are you sure, that /usr/local/nginx/logs/nginx.pid has actual pid of  
> the master process?

Yes according to the tutorial at  
[http://articles.slicehost.com/2009/3/4/ubuntu-intrepid-installing-nginx-from-source](http://articles.slicehost.com/2009/3/4/ubuntu-intrepid-installing-nginx-from-source)

---

<div class="post-metadata">

**Author:** ![pablo\_platt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/d6d6ee/32.png) [@pablo\_platt](https://www.ruby-forum.com/u/pablo_platt)\
**Post date:** [March 8, 2010, 2:34pm UTC](https://www.ruby-forum.com/t/nginx-using-access-log-1-after-using-a-logrotate-script-under-ubuntu-from-source/184706/5 "2010-03-08T14:34:33Z")

</div>

> > Are you sure, that /usr/local/nginx/logs/nginx.pid has actual pid of  
> > the master process?
> 
> Yes according to the tutorial at  
> [http://articles.slicehost.com/2009/3/4/ubuntu-intrepid-installing-nginx-from-source](http://articles.slicehost.com/2009/3/4/ubuntu-intrepid-installing-nginx-from-source)

Have you verified it, e.g. by catting it?

> > but when using a signal manually nginx uses access.log: sudo kill -USR1 `cat nginx.pid`

Here you aren’t using the full path. Where have you executed this from?

Cheers,  
Daniel

–  
[http://daniel.hahler.de/](http://daniel.hahler.de/)

---

<div class="post-metadata">

**Author:** ![pablo\_platt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/d6d6ee/32.png) [@pablo\_platt](https://www.ruby-forum.com/u/pablo_platt)\
**Post date:** [March 8, 2010, 2:32pm UTC](https://www.ruby-forum.com/t/nginx-using-access-log-1-after-using-a-logrotate-script-under-ubuntu-from-source/184706/6 "2010-03-08T14:32:47Z")

</div>

You may want to try the current version from Jeff W.'s (development)  
PPA:  
[https://launchpad.net/~jdub/+archive/devel](https://launchpad.net/~jdub/+archive/devel)

He has a stable PPA, too, but nginx 0.8.x is often used in production  
already.

Cheers,  
Daniel

On Sun, Mar 7, 2010 at 3:13 AM, pablo platt [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> [What is the best way to rotate NGINX log files? - NGINX - Ruby-Forum](http://www.ruby-forum.com/topic/134115)  
> weekly  
> endscript  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

–  
[http://daniel.hahler.de/](http://daniel.hahler.de/)

---

<div class="post-metadata">

**Author:** ![pablo\_platt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/d6d6ee/32.png) [@pablo\_platt](https://www.ruby-forum.com/u/pablo_platt)\
**Post date:** [March 9, 2010, 2:54pm UTC](https://www.ruby-forum.com/t/nginx-using-access-log-1-after-using-a-logrotate-script-under-ubuntu-from-source/184706/7 "2010-03-09T14:54:27Z")

</div>

I’ll use the PPA but want to understand why my logrotate doesn’t work.  
Is it possible to install the PPA and use it reload nginx without  
loosing  
existing connections?  
Do I need to use ‘make uninstall’ on the previous nginx installation  
first?

On Mon, Mar 8, 2010 at 3:33 PM, Daniel H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > Are you sure, that /usr/local/nginx/logs/nginx.pid has actual pid of  
> > > the master process?
> > 
> > Yes according to the tutorial at
> 
> [http://articles.slicehost.com/2009/3/4/ubuntu-intrepid-installing-nginx-from-source](http://articles.slicehost.com/2009/3/4/ubuntu-intrepid-installing-nginx-from-source)
> 
> Have you verified it, e.g. by catting it?

What do you mean by verifying by catting it?

> > > but when using a signal manually nginx uses access.log: sudo kill -USR1  
> > > `cat nginx.pid`
> 
> Here you aren’t using the full path. Where have you executed this from?

I’ve executed it from the /usr/local/nginx/logs folder
