How to restart Nginx on Mac OS X?

Solution 1:

sudo nginx -s stop && sudo nginx

Solution 2:

For a one-liner, you could just do:

sudo nginx -s reload

The -s options stands for signal, and is the option you'll use to send stop, quit, reopen and reload signals to nginx.

For more info on the options, just do nginx -h for a list of all of them and their functions.


Solution 3:

for brew installation: sudo brew services restart nginx

Solution 4:

sudo pkill nginx   
sudo nginx

If the pkill can't be found, then install it using brew install proctools first.

Solution 5:

If you are using brew:

To see all services:

brew services list

Start nginx service:

brew services start nginx

Stop nginx Service:

brew services stop nginx




Mac Osx