Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

nginx

init.d

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

like image 395
mko Avatar asked Jun 07 '12 20:06

mko


1 Answers

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.

like image 130
capsized Avatar answered Oct 17 '22 08:10

capsized