【发布时间】:2015-06-03 07:29:24
【问题描述】:
我最近迁移到 Mac OSX Yosemite 10.10 并关注了this tutorial。
为了设置我的机器,经过多次打嗝后,我终于设法达到了一个点,即我发现由于 nginx 端口问题而只发生了一个问题。
如果我这样做
sudo nginx
我明白了
nginx: [emerg] bind() to 0.0.0.0:443 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:306 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:306 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:306 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:306 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:306 failed (48: Address already in use)
nginx: [emerg] still could not bind()
这意味着 443 和 306 端口正在其他地方使用
当我这样做时
sudo lsof -i:443
我明白了
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 548 root 13u IPv4 0xce9cf564560ec22b 0t0 TCP *:https (LISTEN)
nginx 549 nobody 13u IPv4 0xce9cf564560ec22b 0t0 TCP *:https (LISTEN)
sudo lsof -i:306 类似
我明白了
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 548 root 14u IPv4 0xce9cf564560ed3cb 0t0 TCP *:306 (LISTEN)
nginx 549 nobody 14u IPv4 0xce9cf564560ed3cb 0t0 TCP *:306 (LISTEN)
现在如果 nginx 已经在使用这些端口了,怎么会声称 Address 已经在使用中了
当我在浏览器中运行我的应用程序时说 abc.dev.com
我没有得到服务器的响应,有时浏览器只是告诉我
连接已超时 abc.dev.com 的服务器响应时间过长。
如果我这样做 curl http://abc.dev.com 我会得到
curl: (7) 连接abc.dev.com 80端口失败:操作超时
如果我这样做了
nginx.start
我明白了:
/Library/LaunchDaemons/homebrew.mxcl.nginx.plist:操作已在进行中
如果我这样做::
nginx.stop //它有效,我认为它停止了
如果我这样做:
nginx.restart
我明白了:
/Library/LaunchDaemons/homebrew.mxcl.nginx.plist:找不到指定的服务
我已经没有想法了,想不出任何可能导致这种情况的原因。任何想法都受到高度赞赏...
感谢您的帮助。
【问题讨论】:
标签: php mysql macos curl nginx