Back to blog
Linux & Servers Published August 20, 2026•Updated November 10, 2026

Fix: nginx bind() to 0.0.0.0:80 failed (98: Address already in use)

Automate WhatsApp Alerts
Start Free ➔
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

Quick fix: another process is already listening on the port. Find it, stop it, then start Nginx:

sudo ss -ltnp 'sport = :80'        # shows the process name and PID holding port 80
sudo systemctl stop apache2         # if it's Apache (use the service you found)
sudo systemctl start nginx

If the process holding the port is Nginx itself, an old Nginx was started outside systemd. Run sudo pkill nginx, check the port is free, and start it again with sudo systemctl start nginx.

Error 98 is the Linux error EADDRINUSE. Only one listening socket can own an IP and port pair, so when Nginx calls bind() on a port that is already taken, the kernel refuses and Nginx exits. The same applies to port 443 (bind() to 0.0.0.0:443 failed): replace 80 with 443 in every command below.


1. Find the process holding the port

Use either command. Both show the process name and its PID:

# ss (installed on every modern Linux)
sudo ss -ltnp 'sport = :80 or sport = :443'

# lsof
sudo lsof -nP -iTCP:80 -sTCP:LISTEN

Example output:

LISTEN 0  511  0.0.0.0:80  0.0.0.0:*  users:(("apache2",pid=1234,fd=4))

Here Apache (apache2, PID 1234) owns port 80. If the command prints nothing, no other process holds the port and the conflict is inside your Nginx configuration: skip to section 3 below.


2. Stop whatever owns the port

The port is owned byCheckFix
Apache (apache2 / httpd)systemctl status apache2sudo systemctl stop apache2 && sudo systemctl disable apache2
Another Nginx (started by hand, outside systemd)pgrep -a nginxsudo pkill nginx, then sudo systemctl start nginx
A Docker container (docker-proxy)docker ps --format '{{.Names}} {{.Ports}}'Stop the container, or publish it on another port
Caddy, Traefik, lighttpd or another proxysystemctl status caddy (etc.)Stop and disable it, or move it to another port

Apache started by a package install

On Debian and Ubuntu, installing some packages (for example PHP or Certbot's Apache plugin) pulls in apache2 and starts it on port 80. If you don't use Apache, stop and disable it so it doesn't come back after a reboot:

sudo systemctl stop apache2
sudo systemctl disable apache2
sudo systemctl start nginx

A second Nginx started outside systemd

If someone ran sudo nginx by hand, that copy keeps the ports open, and systemctl start nginx then fails with error 98. Stop every Nginx process and start it once, under systemd:

sudo systemctl stop nginx
sudo pkill nginx
sudo ss -ltnp 'sport = :80'   # should print nothing now
sudo systemctl start nginx

A Docker container publishing port 80

A container started with -p 80:80 makes docker-proxy listen on the host's port 80. If Nginx on the host is meant to sit in front of the container, publish the container on a local port instead and proxy to it:

# docker-compose.yml
services:
  app:
    ports:
      - "127.0.0.1:8080:80"   # only reachable from the host; Nginx proxies to it

Last resort during an incident

fuser kills every process holding the port (it sends SIGKILL). Use it only when you can't stop the owner cleanly:

sudo fuser -k 80/tcp
sudo systemctl start nginx

3. No other process: the conflict is in your Nginx config

If ss shows nothing on the port but Nginx still fails, two listen directives in your own configuration are asking for overlapping sockets. Print every listen line from the full configuration, including all included files:

sudo nginx -T 2>/dev/null | grep -nE '^\s*listen\s'

Look for:

  • An IPv6 listener with ipv6only=off. listen [::]:80 ipv6only=off; makes the IPv6 socket accept IPv4 too, so it collides with listen 80;. Remove ipv6only=off and keep the two listeners separate (since Nginx 1.3.4, listen [::]:80; is IPv6-only by default, so the usual pair listen 80; plus listen [::]:80; is fine).
  • A specific IP and a wildcard on the same port, for example listen 192.168.1.10:80; in one file and listen 80; in another, when the IP isn't actually on this server.

Note: two default_server flags on the same port cause a different error (a duplicate default server for 0.0.0.0:80), not error 98.

Why nginx -t passes but Nginx won't start

nginx -t checks the configuration syntax. It doesn't open the listening sockets, so it can't know that another process holds the port. A clean nginx -t followed by a failed start almost always means section 2 applies.


4. Avoid it next time

  • Reload instead of restart after config changes. sudo nginx -t && sudo systemctl reload nginx keeps the existing listening sockets open, so there's no window for another process to grab the port and no dropped connections.
  • Always manage Nginx through systemd. Don't start it with a bare nginx command on servers that use systemctl.
  • Remove packages you don't use. If Apache isn't needed, sudo apt remove apache2 stops it from returning after upgrades.
  • Bind containers to localhost when a host Nginx proxies to them.

TIME_WAIT connections are not the cause. Nginx opens its listening sockets with SO_REUSEADDR, so leftover client connections in TIME_WAIT never block the port. If you see error 98, a socket in LISTEN state owns the port.


5. Know when it happens on a live server

This error usually appears right after a deploy, an upgrade or a reboot: exactly when nobody is watching the site. Nginx stops, every site behind it goes down, and you find out from users.

An external uptime check catches it within minutes:

  • HTTP monitor on your domain: if Nginx doesn't come back after a deploy, the check fails and you get an alert.
  • Port monitor on 80 and 443: confirms that something is accepting connections on the server's web ports, even before HTTP is answered.

With Pingzo, checks run every 1 to 15 minutes depending on your plan, an incident opens when 3 of the last 5 checks fail, and alerts go to WhatsApp, Slack, Telegram, Discord or email. See how to monitor an Nginx web server for a step-by-step setup.


Related guides

Zero-Code Uptime Alerts

Stop Finding Out About Outages from Angry Users

Get instant WhatsApp & Discord alerts the second your API, website, or server goes down. Setup in 30 seconds, with checks as often as every minute.

WhatsApp & Discord 60-Second Checks Free Forever Plan
Try Pingzo Free

Know before your users do

Connect official WhatsApp notification channels, Discord webhooks, Telegram bots, and public status pages. Start in 30 seconds.

Create Free Monitor