I've installed and configured nginx server on my Mac from MacPorts
sudo port install nginx
- Followed the recommendation from the port installation console and created the launchd startup item for nginx, then started the server.
- Renamed
nginx.conf.example
tonginx.conf
and renamedmime.types.example
tomime.types
.
It works fine, but I couldn't stop it.
I tried sudo nginx -s stop
, but 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.
This command stops also stops nginx.
The correct way to do this for Nginx installed via MacPorts:
sudo port load nginx
sudo port unload nginx
OS X uses launchd so the process of starting/stopping daemons is slightly different.
Look at the PID of master process and do
You may try the following:
Since you installed it following the steps given by macports, I guess you added it to services started at boottime. Have you tried
to stop the Nginx daemon?
You could also have a try with