【问题标题】:Apache/Nginx configuration issue after uninstalling laravel/valet and homestead on macOS Sierra在 macOS Sierra 上卸载 laravel/valet 和 homestead 后的 Apache/Nginx 配置问题
【发布时间】:2018-02-11 02:55:59
【问题描述】:

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

【问题讨论】:

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


    【解决方案1】:

    首先检查nginx是否正在运行

    ps aux | grep nginx
    

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

    brew services list
    

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

    brew services stop nginx
    

    如果它没有被列为已启动或未被列为服务,则尝试手动杀死 nginx

    pkill nginx
    

    现在尝试重启apache

    sudo apachectl restart 
    

    【讨论】:

    • 输出:samuelmccray 42065 0.0 0.0 2432804 1956 s000 S+ 1:57AM 0:00.00 grep nginx 名称状态用户 Plist dnsmasq 已停止 httpd24 已启动 root /Library/LaunchDaemons/homebrew.mxcl.httpd24.plist 错误:服务nginx 未启动。 (那么这里之后和之前一样的错误)
    • lsof -i | grep LISTEN | grep ":80" 的输出是什么,这将告诉您哪个程序正在侦听端口 80。将结果添加到您的问题中,不要评论回复
    • 那个确切的 CLI 命令没有输出,但我在上面的问题中添加了更多信息
    • 然后做一个pkill httpd
    • 太棒了,这似乎奏效了!我不得不重新安装和重新配置 PHP,但它现在似乎可以工作了,谢谢!
    猜你喜欢
    • 2018-06-11
    • 2016-03-31
    • 2017-04-16
    • 2018-06-02
    • 2016-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-11
    相关资源
    最近更新 更多