1

在 macOS Sierra 上卸载 laravel/valet 和 Homestead 后,我切换回 Apache(而不是 NGINX),尝试使用 重新启动它sudo apachectl -k restart,它输出此错误:

httpd not running, trying to start
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs

附加信息- 使用 Homebrew 1.3.1 和 OS Sierra 10.12.6。还使用了与此处找到的类似的本地环境: https ://getgrav.org/blog/macos-sierra-apache-multiple-php-versions

免责声明: 我几乎从不使用 NGINX,但我假设它,或者 laravel/valet 设置中涉及的其他东西阻止 Apache 绑定到正确的端口。

如何修复此错误并重新配置 Apache 以再次使用 Homebrew,而不是 NGINX?

没有输出,lsof -i | grep LISTEN | grep ":80"但有sudo lsof -i :80以下输出:

COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
httpd   12146 root    4u  IPv6 0x3f591ee6220c2a09      0t0  TCP *:http (LISTEN)
httpd   12148 _www    4u  IPv6 0x3f591ee6220c2a09      0t0  TCP *:http (LISTEN)
httpd   37113 _www    4u  IPv6 0x3f591ee6220c2a09      0t0  TCP *:http (LISTEN)
httpd   37114 _www    4u  IPv6 0x3f591ee6220c2a09      0t0  TCP *:http (LISTEN)
httpd   37115 _www    4u  IPv6 0x3f591ee6220c2a09      0t0  TCP *:http (LISTEN)
httpd   38654 _www    4u  IPv6 0x3f591ee6220c2a09      0t0  TCP *:http (LISTEN)
4

1 回答 1

1

首先检查nginx是否正在运行

ps aux | grep nginx

如果它正在运行,则使用 brew 检查它是否正在运行

brew services list

如果显示 nginx 已启动,则使用以下命令停止它

brew services stop nginx

如果它未列为已启动或未列为服务,则尝试手动终止 nginx

pkill nginx

现在尝试重新启动apache

sudo apachectl restart 
于 2017-09-02T05:42:52.207 回答