Mac提示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)

很明显是80端口被占用!

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

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

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

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

把对应的程序(微信、chrome)都关闭掉,发现依然不行。

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

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

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

于是果断 sudo apachectl stop终止掉 apache服务。

问题解决。

文章来源:https://wenku.baidu.com/view/ed1fb85559fb770bf78a6529647d27284b733793.html

Author: thinkwei

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注