问题描述
我在OS X 10.8上使用nginx
.刚安装的nginx
,但是找不到重新启动nginx的方法,除了kill nginx_pid
说kill 64116
.想知道是否有更好的方法重新启动nginx
.
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
.
在Google和SO上找到了一些方法,但是没有用:
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
nginx -s restart
的错误消息是
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"
推荐答案
您的nginx pid文件位置是什么?这是在配置文件中指定的,默认路径在config脚本中指定了编译时.您可以这样搜索它:
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
(必须在nginx运行时发出)
find / -name nginx.pid 2>/dev/null
(must issue while nginx is running)
解决方案:
sudo mkdir -p /usr/local/var/run/
ln -s /current/path/to/pid/file /usr/local/var/run/nginx.pid
这篇关于如何在OS X上重新启动Nginx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!