AH00072: make_sock: could not bind to address error message is generated when there is another process listening on the same port that Apache is configured to use. Typically the port will be the standard port
80 for HTTP connections, or port
443 for HTTPS connections. However, any port conflict with another process can cause an AH00072 error.
The error is derived from the underlying operating system system’s network stack. The issue is that only a single process can be bound to a port at any given time. If another web server like Nginx is configured to listen on port
80 and it is running, then Apache will not be able to claim the port for itself.
To detect a port conflict with Apache, you will need to examine
journalctl output to determine the IP address and port that are causing the error. Then you can decide how to resolve the issue, whether it is by switching web servers, changing the IP address that Apache uses, the port, or any combination of these options.
Following the troubleshooting steps from the How to Troubleshoot Common Apache Errors tutorial at the beginning of this series, the first step when you are troubleshooting an
AH00072: make_sock: could not bind to address error message is to check Apache’s status with
systemctl does not include output that describes the problem, then the last section of this tutorial, Troubleshooting Using
journalctl Logs explains how to examine the
systemd logs to find the conflicting port.
The output from
systemctl status will in many cases contain all the diagnostic information that you need to resolve the error. It will include the IP address that Apache is using, as well as the port that it is attempting to bind to. The output will also indicate how long Apache has been unable to start so that you can determine how long the issue has been affecting Apache.
On Ubuntu and Debian-derived Linux distributions, run the following to check Apache’s status:
- sudo systemctl status apache2.service -l --no-pager
On CentOS and Fedora systems, use this command to examine Apache’s status:
- sudo systemctl status httpd.service -l --no-pager
-l flag will ensure that
systemctl outputs the entire contents of a line, instead of substituting in ellipses (
…) for long lines. The
--no-pager flag will output the entire log to your screen without invoking a tool like
less that only shows a screen of content at a time.
Since you are troubleshooting an
AH00072: make_sock error message, you should receive output that is similar to the following:
Output● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Tue 2020-07-28 13:58:40 UTC; 8s ago Docs: man:httpd.service(8) Process: 69 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) Main PID: 69 (code=exited, status=1/FAILURE) Status: "Reading configuration..." Tasks: 213 (limit: 205060) Memory: 25.9M CGroup: /system.slice/containerd.service/system.slice/httpd.service Jul 28 13:58:40 e3633cbfc65e systemd: Starting The Apache HTTP Server… Jul 28 13:58:40 e3633cbfc65e httpd: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80 Jul 28 13:58:40 e3633cbfc65e httpd: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80 Jul 28 13:58:40 e3633cbfc65e httpd: no listening sockets available, shutting down Jul 28 13:58:40 e3633cbfc65e httpd: AH00015: Unable to open logs Jul 28 13:58:40 e3633cbfc65e systemd: httpd.service: Main process exited, code=exited, status=1/FAILURE Jul 28 13:58:40 e3633cbfc65e systemd: httpd.service: Failed with result 'exit-code'. Jul 28 13:58:40 e3633cbfc65e systemd: Failed to start The Apache HTTP Server.
Note that your output may be slightly different if you are using an Ubuntu or Debian-derived distribution, where the name of the Apache process is not
httpd but is
systemctl output includes some highlighted lines from the
systemd journal that describes the AH00072 error. These lines, both of which begin with
(98)Address already in use: AH00072: make_sock: could not bind to address, give you all the information about the AH00072 error that you need to troubleshoot it further, so you can skip the following
journalctl steps and instead proceed to the Troubleshooting with
ps Utilities section at the end of this tutorial.
systemctl output does not give specific information about the IP address and port or ports that are causing the AH00072 error, you will need to examine
journalctl output from the
systemd logs. The following section explains how to use
journalctl to troubleshoot an AH00072 error.
systemctl output does not include specifics about an AH00072 error, you should proceed with using the
journalctl command to examine
systemd logs for Apache.
On Ubuntu and Debian-derived systems, run the following command:
- sudo journalctl -u apache2.service --since today --no-pager
On CentOS, Fedora, and RedHat-derived systems, use this command to inspect the logs:
- sudo journalctl -u httpd.service --since today --no-pager
--since today flag will limit the output of the command to log entries beginning at 00:00:00 of the current day only. Using this option will help restrict the volume of log entries that you need to examine when checking for errors.
If Apache is unable to bind to a port that is in use, search through the output for lines that are similar to the following log entries, specifically lines that contain the AH00072 error code as highlighted in this example:
Output-- Logs begin at Tue 2020-07-14 20:10:37 UTC, end at Tue 2020-07-28 14:01:40 UTC. -- . . . Jul 28 14:03:01 b06f9c91975d apachectl: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80 Jul 28 14:03:01 b06f9c91975d apachectl: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80 Jul 28 14:03:01 b06f9c91975d apachectl: no listening sockets available, shutting down
This output indicates two AH00072 errors. The first of these explains that Apache cannot bind to the
[::]:80 address, which is port
80 on all available IPv6 interfaces. The next line, with the address
0.0.0.0:80, indicates Apache cannot bind to port
80 on all available IPv4 interfaces. Depending on your system’s configuration, the IP addresses may be different and only show individual IPs, and may only include IPv4 or IPv6 errors.
Even though your own system may have different conflicting interfaces and ports, the errors will be similar to the output shown here. With output from
journalctl you will be able to diagnose the issue using
ss in the following section of this tutorial.
To troubleshoot an AH00072 error you need to determine what other process is listening on the IP address and port that Apache is attempting to use. Most modern Linux distributions include a utility called
ss which can be used to gather information about the state of a system’s network sockets.
In the previous
journalctl section, something was already bound to the IPv4 and IPv6 addresses on port
80. The following command will determine the name of the process that is already bound to an IPv4 interface on port
80. Ensure that you substitute the port from the error message if it is different from
80 in the following command:
- sudo ss -4 -tlnp | grep 80
The flags to the
ss command alter its default output in the following ways:
ssto only display IPv4-related socket information.
-trestricts the output to
-ldisplays all listening sockets with the
-trestrictions taken into account.
-nensures that port numbers are displayed, as opposed to protocol names like ‘http
orhttps`. This is important since Apache may be attempting to bind to a non-standard port and a service name can be confusing as opposed to the actual port number.
-poutputs information about the process that is bound to a port.
With all of those flags, you will receive output like the following:
OutputLISTEN 0 511 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=40,fd=6))
The first three fields are not important when troubleshooting an AH00072 error so they can be ignored. The important fields are the fourth (
0.0.0.0:80), which matches the
journalctl error that you discovered earlier, along with the last
users:(("nginx",pid=40,fd=6)), specifically the
If you have an AH00072 error that is related to an IPv6 interface, repeat the
ss invocation, this time using the
-6 flag to restrict the interfaces to the IPv6 network stack like this:
- sudo ss -6 -tlnp |grep 80
OutputLISTEN 0 511 [::]:80 [::]:* users:(("nginx",pid=40,fd=7))
Again, substitute the port number in question from your
journalctl output if it is different from the highlighted
80 given here.
In both these cases of IPv4 and IPv6 errors, the
ss output indicates that there is a program with process ID 40 (the
pid=40 in the output) that is bound to the
[::]:80 interfaces respectively. This process is preventing Apache from starting since it already owns the port. To determine the name of the program, use the
ps utility like this, substituting the process ID from your output in place of the highlighted
40 value in this example:
- sudo ps -p 40
You will receive output that is similar to the following:
OutputPID TTY TIME CMD 40 ? 00:00:00 nginx
nginx in the output is the name of the process that is listening on the interfaces. Now that you have the name of the program that is preventing Apache from starting, you can decide how to resolve the error. You could stop the
nginx process, reconfigure
nginx to listen on a different interface and port, or reconfigure Apache to avoid the port collision.
It is important to note that the process may be different from
nginx and the port and IP addresses may not always be
[::] if you are diagnosing an AH00072 error. Oftentimes, different web servers and proxies will be in use on the same server. Each may be attempting to bind to different IPv4 ports and IPv6 interfaces to handle different web traffic. For example, a server that is configured with HAProxy listening on the IPv4 loopback address (also referred to as
localhost) on port
8080 will show
ss output like this:
OutputLISTEN 0 2000 127.0.0.1:8080 0.0.0.0:* users:(("haproxy",pid=545,fd=7))
It is important to combine
systemctl output, or
journalctl output that indicates specific IP addresses and ports, with diagnostic data from
ss, and then
ps to narrow down the process that is causing Apache to fail to start.
In this tutorial you learned how to troubleshoot an Apache
AH00072 make_sock: could not bind to address error message on both IPv4 and IPv6 interfaces. You learned how to use
systemctl to examine the status of the Apache server and try to find error messages. You also learned how to use
journalctl to examine the
systemd logs for specific information about an AH00072 error.
With the appropriate error messages from the logs, you then learned about the
ss utility and how to use it to examine the state of a system’s network sockets. After that you learned how to combine process ID information from
ss with the
ps utility to find the name of the process that is causing Apache to be unable to start.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This tutorial series explains how to troubleshoot and fix some of the most common errors that you may encounter when using the Apache web server.
Each tutorial in this series includes descriptions of common Apache configuration, network, filesystem, or permission errors. The series begins with an overview of the commands and log files that you can use to troubleshoot Apache. Subsequent tutorials examine specific errors in detail.