make_sock: could not bind to address no listening sockets available

There are three common causes for this error message.

Address is already in use

Something else is already using the port in question.

Run one of the following commands to check if a running process is holding the port needed by apache open.

On Linux/Unix run
$>  netstat -plant
$> # or
$> sudo lsof -i:80

On Windows run
$>  netstat -ano

On Mac OS X / FreeBSD run
$> netstat -Wan |grep 80
$> # or, to get the pid
$> sudo lsof -i:80

Once you see these results, you can choose to kill the program in question, or change the port that Apache uses.

If Apache (httpd, apache2, etc) is the application listening on these ports, but you can't stop it using your normal procedure, someone may have deleted the servers PidFile. The PidFile records the process ID of the parent process and is how most scripts test to see if Apache is running. You can manually stop the server by determining the PID of the parent process and sending it a SIGTERM.

Note for Windows users, Skype is known to use port 80. Also, make sure Windows IIS Web Server is not running.

Conflicting Listen directives

A configuration like this:

Listen *:80

will incur the same error message. Apache binds to *:80, and then tries to also bind on, which fails because it is already bound by the first line. If you're binding on *:PORT, you do not need to also bind on a specific IP.

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 assigned, and Listen 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

  • No labels