Apache 2 Error “(98)Address already in use”

Overview

I performed a reboot of my server running Apache 2 with SSL and found the sites were not loading when it came back up.

Once the server was backup I assumed Apache had already started but none of the web sites or pages were loading. I proceeded to restart Apache web service and got the following message:
* Starting web server apache2
(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
Action 'start' failed.
The Apache error log may have more information.
[fail]

It appears that if there’s a site configure with a password protected SSL key file the server hangs on start up prompting for the key. I’d assume it would’ve been clever enough to either know it was a system initiated startup or time out.

Fix

I’m currently running Apache 2 on Ubuntu 12.04 and there appears to be no fix for this.

Workaround

A work around is to use a key without a password on it but then you lose the security element.

To get the web service up and running find the process id (PID) for Apache after the system has restarted:
sudo netstat -ltnp | grep ':80'
It will list all processes listening on a port with 80 in it. The results should look something similar to below:

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3154/apache2

The PID is the number before /apache2 so in the example above it’s 3154.

Next kill the process:
sudo kill -9 3154
replacing 3154 with the relevant PID. Run the netstat command again to ensure there are no processes listing on port 80 anymore.

Restart Apache 2 service:
sudo service apache2 start

Summary

Just more inconviences added by having extra security.

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Linux, Web Server and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *.

All comments must go through an approval and anti-spam process before appearing on the website. Please be patience and do not re-submit your comment if it does not appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.