Ubuntu – Apache 2 could not bind, address already in use

Apache2

I installed Apache 2 on Ubuntu 12.10. When I try to start the service using sudo /etc/init.d/apache2 start, I get the following message.

*Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 127.0.0.1:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.                                 [fail]

Best Answer

It's well possible that you have something already running at (or "bound to") that port. Try this command to see processes in question:

sudo lsof -i :80

This lists processes listening on port 80. Once you found the culprit you know which process to kill or kill -9 (also as superuser).

Keep in mind that the Apache instance, assuming you had started that earlier, might have gone "stale" or become a zombie. In the latter case even a reboot may be necessary in some cases.

Otherwise go with the answer from dedunumax.

Related Question