I've installed nginx server on my Mac from MacPorts: sudo port install nginx. Then I followed the recommendation from the port installation console and created the launchd startup item for nginx, then started the server. It works fine (after I renamed nginx.conf.example to nginx.conf and renamed mime.types.example to mime.types), but I couldn't stop it... I tried sudo nginx -s stop - this doesn't stop the server, I can still see "Welcome to nginx!" page in my browser on http://localhost, also I still see master and worker processes of nginx with ps -e | grep nginx.

What is the best way to start/stop nginx on Mac?

BTW, I've added "daemon off;" into nginx.conf - as recommended by various resources.

Thank you.

link|improve this question
feedback

2 Answers

up vote 2 down vote accepted
# nginx -h
...
-s signal     : send signal to a master process: stop, quit, reopen, reload
...
link|improve this answer
When I installed nginx with MacPorts, the above command didn't work - I wasn't giving me an error, but the server kept running. But when I wiped nginx clean and reinstalled it as part of passenger nginx module installation, it works now: I can do "nginx -s stop" and it really stops the server. Thank you! – Alex Kaushovik May 18 '10 at 14:28
feedback

Look at the PID of master process and do

kill -QUIT <master_pid>
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.