I have a problem with Apache on Mac OS Big Sur. After the OS update, the Apache (using Brew) doesn't work anymore.
So I have decided to uninstalled the httpd
Formula.
Then tested is the preinstalled version of Apache works and it does.
sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
brew update
brew doctor
brew upgrade
brew install httpd
(installed successfully)sudo brew services start httpd
However checking the status sudo brew services list
I can see that the httpd service has status error
.
When I try to start apache using sudo apachectl start
I'm receiving the error:
(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
I've checked if maybe there is something else running on the 8080 port lsof -i TCP:8080
but it's not.
I've checked which Apache is used (which apachectl
) and it seems to be the right one (/usr/local/bin/apachectl
)
No matter what port I'm trying to use, always there is an error that the address is already in use.
Does anyone has any idea how to fix this problem?
I was facing the same problem.
It appears that bindings to INADDR_ANY (0.0.0.0)
fail.
To circumvent the bind error, I changed in /usr/local/etc/httpd/httpd.conf
the following line:
Listen 8080
to:
Listen 127.0.0.1:8080
Afterwards, I could start apache without the bind error, using the following command:
sudo apachectl -k start
I had the same problem, but needed to run apache on port 80. First I got it working on 8080 with the solution above by @FrankStappers with:
Listen 127.0.0.1:8080
ServerName localhost:8080
Next I tried changing the port to 80 in both Listen and ServerName directives. Restarting left me with these errors:
(13)Permission denied: AH00072: make_sock: could not bind to address 127.0.0.1:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Ultimately changing Listen and ServerName as follows fixed it:
Listen 0.0.0.0:80
ServerName localhost
The solution is documented in the Troubleshooting Non-Sudo httpd Services Start section of https://getgrav.org/blog/macos-bigsur-apache-multiple-php-versions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With