Fun with Apache2 – httpd not running, trying to start (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down

Have you ever gotten this error message when trying to (re)start Apache

httpd not running, trying to start
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down

If you are running with an SSL certificate on your box, Apache cannot start up without the correct passphrase. I’ve run into this problem a couple times. Once when I rebuilt my virtual server from Mosso and the reboot process (obviously) required Apache to be started up when the machine came back up. Not being there when the start up phase required the correct passphrase Apache was up but not handling requests. The other time my server crashed when it ran out of memory. It was a 256 meg O’RAM box running a Rails app. Go figure!

Fortunately, there is an easy solution. Kill Apache and start it up again. If you’re in the console you’ll be prompted for the passphrase. Enter it correctly and everything will be fine. Here’s how I did it.

ps aux | grep apache
root      3948  0.0  0.2   4028   668 ?        S    17:48   0:00 /bin/sh -e /etc/rc2.d/S91apache2 start
root      3959  0.0  0.2   4028   616 ?        S    17:48   0:00 /bin/sh /usr/sbin/apache2ctl start
root      3964  0.0  2.4 133564  6472 ?        S    17:48   0:00 /usr/sbin/apache2 -k start
root      4069  0.0  0.2   6268   660 pts/0    R+   17:49   0:00 grep apache

I took at a look at the running processes and grep for apache. The one I wanted was the 2nd to last.
Look for the process id and kill it with the -9 option. The process id will be in the second column to the left

kill -9 3964

After it’s dead you can restart Apache like so

apache2ctl start

You’ll get the prompt for the passphrase. Enter it and everything should be fine.

Related posts:

  1. Rails, SSL, Ubuntu, Apache2 with Phusion on Ubuntu
  2. Setting up a new ubuntu server with apache2, php, ruby on rails, rubygems, mysql, and git
  3. Add User Directories to Apache2 Web Server
  4. Wildcard VirtualHost with Apache2
  5. Deploy Sintra App on Ubuntu Using Apache2 and Phusion Passenger Module
This entry was posted in apache and tagged , , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment

  1. Posted October 16, 2009 at 2:15 pm | Permalink

    and that’s the last time we roll back a server resize because it won’t start up again…

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>