Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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]
share|improve this question
    
Make sure apache is not already running when (ps -ef | grep apache). And what does sudo /etc/init.d/apache2 restart say? Verify you have your a site in /etc/apache2/sites-enabled/ and check the files in there. –  Rinzwind Feb 21 '13 at 13:55
add comment

3 Answers

Try sudo service apache2 start

then type

sudo service apache2 status

second command will display whether it is running or not.

share|improve this answer
add comment

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.

share|improve this answer
add comment

I got this error message with the following configuration:

# cat /etc/hosts
127.0.0.1   localhost
127.0.0.1   foo
...

# cat /etc/apache2/sites-enabled/foo
<VirtualHost foo:80>
...

# cat /etc/apache2/ports.conf 
...
NameVirtualHost *:80
Listen localhost:80
...

Changing ports.conf to the following solved the problem:

NameVirtualHost *:80
Listen 127.0.0.1:80
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.