Solved – make_sock: could not bind to address 0.0.0.0:80 no listening sockets available

My apache was stucked..sites are dead due to following error

Apache HTTPD: Address already in use: make_sock: could not bind to address 0.0.

More details:
When i type: /etc/init.d/httpd restart it says:

(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down

I did searched for solution but everybody is saying about kill the apache process and restart the httpd.

But nobody was taking about solution.

Here is the issue:

Trying to listen an IP not bound to an active interface on the server

When trying to bind to an IP and port not present on the host system, apache httpd will fail to start. For example, if the network interface has the IP 1.1.1.1 assigned, and Listen 2.2.2.2:PORT is used, this error will be triggered. In the event that the IP will change on a regular basis, it is recommended to use Listen PORT or Listen *:PORT instead.

You’re not root

Unix based systems disallow non-root users to bind processes to port numbers below 1024. Get root!

SELinux / AppArmor is preventing apache httpd from binding to a specific IP/PORT

The problem is the policy which allows only typical http ports.

List them with:

semanage port -l|grep http

And add your favourite port to the existing policy:

semanage port -a -t http_port_t -p tcp <PORT>

apachectl/httpd stop and start in rapid succession

Use apachectl restart or wait a few seconds between stop and start
If you found following error then use following command:
semanage, command not found?

#yum -y install policycoreutils-python

Then use above command.

 

could not bind to address 0.0.0.0:80 no listening sockets available

could not bind to address 0.0.0.0:80 no listening sockets available

About Purab Kharat

I am from India, Pune. I am WordPress and Drupal Architect and consultant. I worked on many technologies like Ruby on Rails, Flex, PHP, jQuery etc... Senior Technical Lead at Smartsourcing Global Pvt Ltd in Princeton, NJ, USA. I contributed to many wordpress plugins and Drupal Modules. I contributed to Drupal core also. Connect to purab on LinkedIn or Follow @purab on Twitter or Follow me on or Write Mail to purabdk@gmail.com or Chat with me on Skype : purabdk
This entry was posted in Apache and tagged , , , , , . Bookmark the permalink.

Leave a Reply