clw*_*wen 52 macos restart nginx
我nginx在OS X 10.8上使用.新安装nginx但无法找到重启nginx的方法除外kill nginx_pid说kill 64116.想知道是否有更好的方法重新启动nginx.
在Google和SO上找到了一些方法,但没有奏效:
nginx -s restart
sudo fuser -k 80/tcp ; sudo /etc/init.d/nginx restart
Run Code Online (Sandbox Code Playgroud)
错误消息nginx -s restart是
nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory)
Run Code Online (Sandbox Code Playgroud)
有时也会得到这个错误消息:
nginx: invalid option: "-s restart"
Run Code Online (Sandbox Code Playgroud)
Mah*_*dsi 19
你的nginx pid文件位置是什么?这在配置文件中指定,在配置脚本中指定编译时的默认路径.你可以这样搜索它:
find / -name nginx.pid 2>/dev/null (必须在nginx运行时发出)
解:
sudo mkdir -p /usr/local/var/run/
ln -s /current/path/to/pid/file /usr/local/var/run/nginx.pid
Run Code Online (Sandbox Code Playgroud)
tob*_*bek 19
要重新加载配置文件:
sudo nginx -s reload
Run Code Online (Sandbox Code Playgroud)
要完全重启nginx:
sudo nginx -s quit
sudo nginx
Run Code Online (Sandbox Code Playgroud)
细节
restartnginx 没有信号.从文档中,以下是主进程接受的信号:
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.
Run Code Online (Sandbox Code Playgroud)
据推测,您可以手动将这些信号发送到进程ID,但该nginx命令具有nginx -s <signal>向您的主进程发送信号的标志.你的选择是:
stop SIGTERM
quit SIGQUIT
reopen SIGUSR1
reload SIGHUP
Run Code Online (Sandbox Code Playgroud)
手动无需使用pid.
编辑:刚刚意识到这些信息已经在其他答案的评论中.无论如何离开这里总结一下情况.
小智 8
$ sudo nginx -c /usr/local/etc/nginx/nginx.conf
$ sudo nginx -s reload
Run Code Online (Sandbox Code Playgroud)
源码链接:https : //blog.csdn.net/github_33644920/article/details/51733436
我是这样做的:
首先杀死进度
ps aux | grep nginx
kill -9 {pid}
Run Code Online (Sandbox Code Playgroud)
然后启动nginx
nginx
Run Code Online (Sandbox Code Playgroud)
有用!
| 归档时间: |
|
| 查看次数: |
76605 次 |
| 最近记录: |