48)地址已在使用:AH00072:make_sock:无法绑定到地址[::]:80

2022-01-25 00:00:00 macos localhost php apache

当我尝试访问任何文件夹或文件时出现 apache 错误,它返回 Http Not foundForbidden我正在尝试重新启动并启动 apache

I get a apache error when I try access to anything folder or file, it returns Http Not found or Forbidden I am trying restart and start apache

sudo apachectl restart

输出:

(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

我想阻止它

sudo apachectl stop

输出

httpd (no pid file) not running

我运行 sudo lsof -i:80

输出:

COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME

    httpd    8904 root    5u  IPv6 0x21884d81f1597d8f      0t0  TCP *:http (LISTEN)
    httpd    9012 _www    5u  IPv6 0x21884d81f1597d8f      0t0  TCP *:http (LISTEN)
    httpd   12726 _www    5u  IPv6 0x21884d81f1597d8f      0t0  TCP *:http (LISTEN)
    httpd   12731 _www    5u  IPv6 0x21884d81f1597d8f      0t0  TCP *:http (LISTEN)
    httpd   12732 _www    5u  IPv6 0x21884d81f1597d8f      0t0  TCP *:http (LISTEN)

有什么办法解决这个问题吗?

Any idea to solve that ?

有用的信息:

OS X El Capitan

推荐答案

在我的带有 Mojave (10.14.1) 的 Mac 中突然 Apache 无法再提供 ipv4 服务,然后给了我 ERROR 403.我试图杀死所有 apache(sudo killall httpd)...检查 de PID(sudo lsof | grep AMP | grep apache)...甚至没有工作...只有 ipv6 可用...仍然是错误 403.

In my Mac with Mojave (10.14.1) suddenly Apache couldn't give to serve ipv4 anymore, then gave me ERROR 403. I tried to kill all apache (sudo killall httpd)... checking de PID's on (sudo lsof | grep AMP | grep apache)... even didn't work... just ipv6 was available... still ERROR 403.

什么对我有用:禁用 OSX 的内置 Apache 服务器.

What works for me: Disable OSX's built-in Apache server.

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

之后:

sudo apachectl -k restart

要开心:)

相关文章