I just installed Nginx on Mac OS X (thanks http://www.kevinworthington.com/nginx-mac-os-snow-leopard-2-minutes/), but how do I restart Nginx on Mac OS X?
Thanks!
I just installed Nginx on Mac OS X (thanks http://www.kevinworthington.com/nginx-mac-os-snow-leopard-2-minutes/), but how do I restart Nginx on Mac OS X?
Thanks!
sudo nginx -s stop && sudo nginx
&& means? I guess it's something different then using ;?
– hobbes3
Mar 15 '13 at 20:03
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.
Cheers!
sudo nginx to get it to start. I think it had something to do with nginx already being stopped in my case.
– james-see
May 19 '16 at 17:40
for brew installation: sudo brew services restart nginx
brew services restart nginx i get response:
Stoppingnginx... (might take a while)
==> Successfully stoppednginx(label: homebrew.mxcl.nginx)
==> Successfully startednginx(label: homebrew.mxcl.nginx)
– kris_IV
Dec 25 '18 at 11:32
sudo nginx -s stop && sudo nginx instead everything is OK and new config work.
– kris_IV
Dec 26 '18 at 11:11
nginx
– funder7
Dec 15 '20 at 12:41
sudo pkill nginx
sudo nginx
If the pkill can't be found, then install it using brew install proctools first.
sudo nginx -s quit or sudo -s reload
– paperclip
Oct 18 '16 at 11:34
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
sudo nginx -s quit && sudo nginx
Checkout nginx guide
Using MAMP and Nginx? Then you have an installed script:
sudo /Applications/MAMP/bin/restartNginx.sh
Just another note, if you want to start nginx with launchctl, when your Mac boots up, you can do as follows:
sudo cp /usr/local/opt/nginx/*.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
In short, you need to put your plist file in /Library/LaunchDaemons, not in ~/Library/LaunchAgents like the Homebrew instructions. Finally, use the -w option with launchctl. For further information, follow this guide.
If you installed nginx with brew and you started it as a service brew services start nginx then you can issue: brew services restart nginx
sudo nginx -s reload. – hobbes3 Mar 16 '13 at 21:26