Fix Apache AH00072: make_sock: could not bind to address
Apache AH00072 make_sock: could not bind to address: a Listen socket failed. The (98), (99) or (13) prefix means port in use, missing IP or permission.
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80no listening sockets available, shutting downAH00015: Unable to open logsApache could not open a socket on the address and port in a Listen line, so it stopped. The number in parentheses at the start is the cause. (98) means something already holds the port — find it with ss -ltnp. The AH00015: Unable to open logs line below is a side effect of the aborted start; do not chase it as a log file problem.
[1] Read the number in parentheses.
| Prefix | Meaning | Go to |
|---|---|---|
(98)Address already in use | another process, or another Listen in your own config, already holds it | [2], [3] |
(99)Cannot assign requested address | the Listen IP does not exist on this server | [4] |
(13)Permission denied | a non-root user tried to open a port below 1024 | [5] |
A config test does not catch this. In all three cases httpd -t printed Syntax OK; the error only appeared on a real start. Passing the test does not mean a restart will succeed.
[2] Find the process that holds the port. Run as root to see process names.
$ sudo ss -ltnp "sport = :80"State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess LISTEN 0 511 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=1,fd=6))LISTEN 0 511 [::]:80 [::]:* users:(("nginx",pid=1,fd=7))Here nginx owns port 80 — common when nginx and Apache are installed on the same server. Stop one of them (sudo systemctl stop nginx takes that service down), or move Apache to another port and put nginx in front as a proxy. If the list shows apache2 or httpd, Apache is already running and you started it a second time; use sudo systemctl restart apache2 instead of starting a new copy.
[3] If nothing else holds the port, two of your own Listen lines overlap. An exact duplicate is caught by the config test with a different message:
AH00526: Syntax error on line 552 of /usr/local/apache2/conf/httpd.conf:Cannot define multiple Listeners on the same IP:portBut lines that look different and overlap, such as Listen 80 plus Listen 0.0.0.0:80, pass with Syntax OK and then fail at start with the (98) at the top. The official docs also say overlapping Listen directives are a fatal error that prevents startup. Collect every Listen line; on Ubuntu they live in ports.conf.
$ grep -rn "^\s*Listen" /etc/apache2//etc/apache2/ports.conf:5:Listen 80/etc/apache2/ports.conf:8: Listen 443/etc/apache2/ports.conf:12: Listen 443443 appears twice because one copy sits in <IfModule ssl_module> and the other in <IfModule mod_gnutls.c>; normally only one is active. If you added a Listen to a site file (sites-available/*.conf), remove it and keep all of them in ports.conf.
[4] (99) means a Listen such as Listen 192.0.2.10:80 names an address this server does not have.
(99)Cannot assign requested address: AH00072: make_sock: could not bind to address 192.0.2.10:80Check the real addresses with ip -br addr and fix the line, or drop the address and use Listen 80. Cloud servers hit this when the public IP is not configured on any interface inside the server. Apache starting before the network is up at boot can cause the same error; that case was not tested.
[5] (13) means a non-root user tried to open 80 or 443. This is www-data (uid 33) with ports below 1024 restricted:
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80The official docs (mod_unixd, User) say the server must be run initially as root to use User, and that the parent process normally stays root. With the usual root-started service (systemctl) this error therefore does not occur. Check whether you ran apachectl as a normal user, or ran a container as a non-root user. If it must run without root, use a high port such as Listen 8080.
[6] Start again after the fix. If you changed Listen, stop and start rather than reload. The official docs explain that during a restart httpd keeps the old ports bound, so a change that conflicts with the old config — for example Listen 127.0.0.1:80 to Listen 80 — makes the configuration fail and the server terminate.
$ sudo apache2ctl configtest$ sudo systemctl stop apache2 && sudo systemctl start apache2$ sudo ss -ltnp "sport = :80"The site is down while stopped, so do it at a quiet time. If the start fails, revert the Listen line and run start again.
For the nginx version of this problem (bind() to 0.0.0.0:80 failed (98)) see nginx bind() failed (98).
Analyze your Apache log in the browser ↗ — nothing is uploaded.