How to restart nginx on OS X
To reload config files:
sudo nginx -s reload
To fully restart nginx
:
sudo nginx -s quit
sudo nginx
Details
There is no restart
signal for nginx. From the docs, here are the signals that the master process accepts:
SIGINT, SIGTERM Shut down quickly.
SIGHUP Reload configuration, start the new worker process with a new configuration, and gracefully shut down old worker processes.
SIGQUIT Shut down gracefully.
SIGUSR1 Reopen log files.
SIGUSR2 Upgrade the nginx executable on the fly.
SIGWINCH Shut down worker processes gracefully.
Presumably you could send these signals to the process id manually, but the nginx
command has the flag nginx -s <signal>
that sends signals to the master process for you. Your options are:
stop SIGTERM
quit SIGQUIT
reopen SIGUSR1
reload SIGHUP
No need to futz with the pid manually.
Edit: just realized much of this info was already in comments on the other answers. Leaving this here anyway to summarize the situation.
What is your nginx pid file location? This is specified in the configuration file, default paths specified compile-time in the config script. You can search for it as such:
find / -name nginx.pid 2>/dev/null
(must issue while nginx is running)
Solution:
sudo mkdir -p /usr/local/var/run/
ln -s /current/path/to/pid/file /usr/local/var/run/nginx.pid
$ sudo nginx -c /usr/local/etc/nginx/nginx.conf
$ sudo nginx -s reload
Source Link: https://blog.csdn.net/github_33644920/article/details/51733436
Try running sudo nginx
before starting nginx.