How to restart nginx on OS X

clwen picture clwen · Jan 5, 2013 · Viewed 90.1k times · Source

I'm using nginx on OS X 10.8. Freshly installed nginx but can't find a way to restart nginx except kill nginx_pid say kill 64116. Wondering if there are better ways to restart nginx.

Found some methods on Google and SO but didn't work:

nginx -s restart

sudo fuser -k 80/tcp ; sudo /etc/init.d/nginx restart

The error message for nginx -s restart is

nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory)

Sometimes also get this error msg:

nginx: invalid option: "-s restart"

Answer

Benjamin Crouzier picture Benjamin Crouzier · Jan 30, 2014

Try running sudo nginx before starting nginx.