I’m using the init.d script from this: http://wiki.nginx.org/RedHatNginxInitScript but this script sucks on my CentOS 5.5 nginx 1.0.6 (which installed by passenger).
It sucks for 2 reasons:
-
When I run
service nginx start, it start nginx but then do not quit it self. -
It run in some different runtime path ($PATH) so that rails won’t be able to find executables located inside /usr/local/bin (like node.js)
Is there any init.d script that works for you guys (on CentOS or other Redhat based distribution) that does not have these problems?
The one here: http://articles.slicehost.com/2009/2/2/centos-adding-an-nginx-init-script has worked for me in the past.
You will need to change the paths to “/etc/nginx” instead of “/usr/local/nginx” for instance.
Actually both are similar except that your old one has an additional “MakeDirs” function. Not sure why this may this be needed.
My current one is below:
This is what is distributed with the Nginx RPM from EPEL.