Ubuntu – Apache restart on Ubuntu – error “could not bind to address 0.0.0.0:80”

apache-2.2Ubuntuubuntu-9.10

I'm a n00b – trying to get apache2 set up on Ubuntu 9.10 (Karmic Koala) on Rackspace Cloud. I have set up/configured OpenSSL and installed Apache, but Apache won't start. I assume its a misconfiguration in my /etc/apache2/sites-available/ssl or /etc/apache2/sites-available/default files)

When I try to restart apache using the command:

sudo /etc/init.d/apache2 restart
I get the following error message:

[error] (EAI 2)Name or service not known: Could not resolve host name *.80 -- ignoring! 
[error] (EAI 2)Name or service not known: Could not resolve host name *.80 -- ignoring! 
(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 ...fail!

For my /etc/apache2/sites-available/ssl I have used a virtual host of *:443.

For my /etc/apache2/sites-available/default i have used a virtual host of *:80

Best Answer

The error messages speaks of .80 and not :80, look through all your configuration files to see if you have anything mentioning this. Doublecheck ServerName settings.

The final error means that a process is already using port 80 on your server, bound to one or all interfaces. To see which one, logon as root and type: netstat -nap | grep :80 and check what process it is, and kill it if its not supposed to be running. Most likely a dead/orphaned apache/httpd process that got stuck when you've started/restarted. Manually kill it if needed.

Related Topic