nginx.ccWeb server troubleshooting desk
Home / Errors / bind
bind

nginx: bind() failed (98: Address already in use)

Short answer

Port 80/443 is already taken (Apache, Caddy, a panel, a Docker container, another nginx), or the config listens on the same IPv6 socket twice.

Most common cause: apache2/httpd started at boot and holds port 80.

Try this first: Stop and disable the other service

systemctl disable --now apache2      # httpd on RHEL
systemctl restart nginx

Last verified: · against the official docs listed below · Sources

Typical log lines

bind() to 0.0.0.0:80 failed (98: Address already in use)
bind() to [::]:443 failed (98: Address already in use)
still could not bind()

Common causes

  1. apache2/httpd started at boot and holds port 80.
  2. A Docker container publishes -p 80:80 or -p 443:443.
  3. An old nginx master is still running (started by hand, then via systemctl).
  4. Several servers repeat listen [::]:80 with conflicting ipv6only options.

Diagnosis commands

Who holds the ports
#ss -ltnp '( sport = :80 or sport = :443 )'
Is a container publishing them
#docker ps --format '{{.Names}} {{.Ports}}' | grep -E ':(80|443)->'
Leftover nginx processes
#ps -ef | grep [n]ginx

Fix configs

Stop and disable the other service

systemctl disable --now apache2      # httpd on RHEL
systemctl restart nginx

Leftover master process

nginx -s quit || pkill -QUIT -x nginx
systemctl start nginx

Set IPv6 listen options once

# ipv6only, default_server, reuseport and similar parameters may appear in only one server per address:port
listen 80 default_server;
listen [::]:80 default_server;

Run nginx -t first, then systemctl reload nginx.

Key facts and sources

  • listen's ipv6only parameter defaults to on, so listen 80 and listen [::]:80 can coexist. [nginx.org]

Checked against the linked pages on 2026-11-14; the official docs win if a newer nginx changes them.

FAQ

Can nginx and Apache both use port 80?

Not on the same port. Move Apache to 8080 and let nginx on 80/443 proxy to it.

A Docker container holds port 80. What now?

Find the container publishing 0.0.0.0:80 with docker ps, stop it or move it to another port, and let nginx reverse-proxy to that port.

Fix it with a tool

Related errors

Sponsored slot (empty)
VPS / CDN recommendations may appear here later, labelled as affiliate links. There are no referral links today.