在macOS Sierra上卸载laravel / valet和homestead之后的Apache / Nginx配置问题

时间:2017-09-02 04:31:32

标签: apache laravel nginx macos-sierra laravel-valet

在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)

1 个答案:

答案 0 :(得分:1)

首先检查nginx是否正在运行

ps aux | grep nginx

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

运行
brew services list

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

brew services stop nginx

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

pkill nginx

现在尝试重启apache

sudo apachectl restart