打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
mac 上nginx的错误 nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)

今天在mac上运行nginx,发现一直报错:

nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use) 

查到的解决方法是nginx自己占用了80端口,又把自己block住,只要killall -9 nginx 即可。

试了下,发现根本找不到nginx进程。

使用ps -ef | grep nginx 也同样找不到。

于是查看是哪些进程占用了80端口:lsof -i:80

把对应的程序都关闭掉,发现依然不行。

通过浏览器访问http://localhost发现得到的页面根本没有在nginx的任何地方定义过。也就是说当前服务器启动的并不是nginx。

用chrome的开发者工具查看了下响应消息,响应消息的powdered-by字段赫然写着apache。

猛然想起来前不久为了测试一个php项目,启用了mac自带的apache服务器。

于是果断 sudo apachectl stop终止掉apache服务。问题解决。

顺带提一句,当nginx -s reload命令出现:nginx: [error] open()"/opt/local/var/run/nginx/nginx.pid" failed (2: No such file ordirectory)错误的话,解决办法:

nginx -c /opt/local/etc/nginx/nginx.conf(your/path/to/config/file)

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
OpenCDN部署常见错误汇集
[emerg] open() “/var/run/nginx/nginx.pid” failed (2: No such file or directory)
apache启动报错(98)Address already in use: make_sock: could not bind to...
Port 80 or 443 (SSL) already in use ! Installing Apache2.2 service failed!的解决方案
nginx启动报错 99
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服