ubuntunginxdaemoninit.d

Nginx daemon stop is failing


I've got Ubuntu 11.04 i386 server with nginx 1.0.11 installed. Also, I'm using this init.d script, the only one I've found in several different places. It starts the server nicely, however, on stop/reset it says

* Stopping Nginx Server...      [fail]

Of course, the daemon is not stopped, and upon restart the configuration is not reloaded.

How can I repair this?


Solution

  • It's likely that it can't kill the process.

    Open up the nginx sysvinit script located in /etc/init.d/ (or /etc/rc.d/) and find where nginx.pid is thought to be. It'll be something like "/var/run/nginx.pid".

    If the pid file isn't there, open nginx.conf and look for the pid setting. If it is a mismatch - set the conf value to where the script thinks it should be, e.g.

    # pid of nginx process
    pid /var/run/nginx.pid;