Add nginx as a ubuntu service stop and reload doesn't work

My nginx was compile from the source, only give the flag that --conf-path=/etc/nginx/nginx.conf

Everything works and I was trying to use this service init.d script to make nginx as a system service,

Here's the script that I made only 2 minor changes:

1. DAEMON=/usr/local/nginx/sbin/nginx

2.NGINX_CONF_FILE="/etc/nginx/nginx.conf"

then sudo service nginx start

it works

yozloy@SNDA-172-17-10-158:/usr/local$ sudo service nginx start
 * Starting Nginx Server...
   ...done

.

but service nginx stop and service nginx reload

give me a error

yozloy@SNDA-172-17-10-158:/usr/local$ sudo service nginx stop
 * Stopping Nginx Server...
   ...fail!

and the error doesn't appear on the log/error.log file


I've had similar problems with Nginx on Ubuntu 12.04, with nginx compile from source and init script taken from a similar source as yours.

Service started well with the init file, but stop or restart didn't. In the end the cause was a different path to the pid file in the nginx.conf and the init script. Make sure they both point to the same location.

链接地址: http://www.djcxy.com/p/95178.html

上一篇: Nginx + Passenger

下一篇: 添加nginx作为ubuntu服务停止并重新加载不起作用