Written by Sean Behan on Sun Jun 17th 2012

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.

Tagged with..
#apache #apache2ctl #httpd #out of memory #passphrase #reboot #ssl #apache

Just finishing up brewing up some fresh ground comments...