When starting or restarting Apache HTTPD server which was previously working properly, error occurred and the Apache HTTPD service could not be started. One of the following error message or similar message is displayed and recorded in error log:
Starting httpd/ web server apache2 : (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[FAILED] / Action ‘start’ failed
The error can happen on port 443 too, where you will see a line of message like the following:
(98)Address already in use: make_sock: could not bind to address [::]:443
The error normally happens after Apache HTTPD web server service crashed but does not exited or terminated cleanly, leaving some remnant processes running, using and occupying ports or other system resources such as port 80 and port 443 (for SSL / HTTPS websites) that are critical for Apache service to launch anew successfully.
Use one of the following commands to determine if port 80 or port 443 is indeed been used by orphaned Apache or any other services:
netstat -anp --tcp --udp | grep LISTEN
Above command lists out all processes running and listening on port 80 and 443
fuser -v 80/tcp
fuser -v 443/tcp
Above commands list out the process IDs and commands which is running on port 80 or port 443.
As the processes are already orphaned, attempt to exit the processes by stopping the Apache HTTPD service no longer work, as system has assumed Apache HTTPD service stopped.
To resolve the issue, kill the remnant processes that are occupying the critical port 80 and/or 443 with the following command:
kill -9 <process ID>
Alternatively, run the following command:
fuser -k -n tcp 80
Replace the port number with 443 if you’re encountering the error on SSL port.
Once all processes hogging with Apache HTTPD web server’s ports are killed and terminated, you can start Apache HTTPD service successfully.