问题描述
在 BigSur 上更新我的 MacO 后,我在使用 httpd(又名 Apache2)时仍然遇到一些问题.
I'm still having some problems on using httpd (aka Apache2) after the update of my MacOs on BigSur.
我尝试使用 brew httpd 服务重新安装 apache2(就像很多教程中所说的那样),但它仍然无法正常工作.我总结了所采取的步骤,并添加了一些调试命令.
I tried to make a clean reinstall of apache2 using the brew httpd services (like said in a lot of tutorials) but it still not working. I make a summary of the steps taked and I'll add some debug command.
重新安装我完成了:
sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
brew install httpd
之后我重新启动并启动命令:
After that I reboot and launched the command:
brew services start httpd
==> Successfully started `httpd` (label: homebrew.mxcl.httpd)
但是如果我运行以下命令:
But if I run the following command:
brew services list
Name Status User Plist
dnsmasq started root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
fuseki stopped
httpd error matteo.ceradini /Users/matteo.ceradini/Library/LaunchAgents/homebrew.mxcl.httpd.plist
mongodb-community started matteo.ceradini /Users/matteo.ceradini/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
unbound stopped
如您所见,httpd 处于错误状态(实际上转到 localhost:8080 时出现错误),我不明白为什么.
As you can see the httpd is in an error status (in fact going to localhost:8080 I get an error) and I can't understand why.
有什么建议可以解决这个问题吗?
Any suggestion how to fix this?
谢谢.
推荐答案
有些东西似乎不起作用,但我仍然找不到原因.
Something seems to not working, but still I can't find why.
我停止了所有服务(sudo brew 和不带 sudo 的 brew),然后运行命令:
I stopped all the services (either sudo brew and brew without sudo), and next running the commands:
sudo lsof -i :80
sudo lsof -i :8080
sudo lsof -i tcp:80
sudo lsof -i tcp:8080
结果总是一无所获.但如果我跑:
the results is always nothing. But if I run:
sudo brew services start httpd
==> Successfully started `httpd` (label: homebrew.mxcl.httpd)
httpd 不会启动(即使在终端命令中它说是):
The httpd will not start (even if in the terminal command it says yes):
sudo brew services list
httpd error root /Library/LaunchDaemons/homebrew.mxcl.httpd.plist
如果我检查 apachetl 错误,我总是会发现端口 80 已被占用,即使该端口上没有进程:
And if I check the apachetl error I get always that the port 80 is occupied, even if there isn't processes on that port:
apachectl -e error
(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
我迫切需要为这个错误找到解决方案.好像有些httpd损坏了,就算我卸载重装了
I urgently need to find a solution for this bug. It seems that in some httpd is corrupted, even if I uninstall and reinstall again
更新:
我真的不知道我是怎么做到的,但现在它起作用了.我停止了所有 brew httpd 服务,并使用以下命令重新启动 apache:
I really don't know how I did it, but now it's working. I stopped all the brew httpd services and I restard apache using the command:
sudo apachectl -k start
这对我有用
这篇关于重新安装并修复 macos 上的 httpd 服务错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!