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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With