macos - Mac OS Big Sur - Homebrew Apache - 48)地址已在使用中:AH00072:make_sock:无法绑定到地址 0.0.0.0:8080
问题描述
我在 Mac OS Big Sur 上遇到 Apache 的问题。操作系统更新后,Apache(使用 Brew)不再工作。所以我决定卸载httpd
公式。然后测试的是 Apache 的预装版本,它确实有效。
- 所以我已经停止了预装的 Apache
sudo apachectl stop
- 卸载的发射器
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
- 更新了自制软件
brew update
brew doctor
brew upgrade
- 再次安装httpd
brew install httpd
(安装成功) - 启动httpd
sudo brew services start httpd
但是检查状态sudo brew services list
我可以看到 httpd 服务有 status error
。当我尝试使用启动 apache 时sudo apachectl start
收到错误消息:
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:8080
no listening sockets available, shutting down
AH00015: Unable to open logs
我已经检查过 8080 端口上是否有其他东西在运行,lsof -i TCP:8080
但事实并非如此。
我检查了使用的是哪个 Apache ( which apachectl
),它似乎是正确的 ( /usr/local/bin/apachectl
)
无论我尝试使用哪个端口,总是会出现地址已在使用中的错误。
有谁知道如何解决这个问题?
解决方案
我面临着同样的问题。看来绑定INADDR_ANY (0.0.0.0)
失败了。
为了规避绑定错误,我更改/usr/local/etc/httpd/httpd.conf
了以下行:
Listen 8080
至:
Listen 127.0.0.1:8080
之后,我可以使用以下命令启动 apache 而不会出现绑定错误:
sudo apachectl -k start
推荐阅读
- ajax - DataTables 不分页 - 使用 ajax
- python - PyInstaller“致命错误:无法执行主脚本”
- kotlin - 片段绑定中选定项目的问题
- python - 如何在 Pandas 中创建新列?
- sql - 具有交叉连接的 Oracle 查询 - 性能问题
- backup - 备份 Hyper-V 虚拟机
- android - SharedPreference 不会应用更改(在片段中)
- windows - 如何删除执行任何 .BAT 文件的语法错误?
- java - NetBeans JPA 与 Eclipse
- postgresql - 在 PostgreSQL 13.0 中限制数据库大小的最佳方法是什么?