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.
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 22.214.171.124 assigned, and Listen 126.96.36.199: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.