Skip to content
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

DodaTech 2 min read

The error “nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)” means another process is already listening on port 80, preventing Nginx from binding.

What It Means

When Nginx starts, it opens a listening socket on the port specified in server blocks. The bind() system call fails with EADDRINUSE because the port is already occupied. This is common for port 80 (HTTP) and 443 (HTTPS), but can happen on any port.

Why It Happens

  • Another instance of Nginx is already running.
  • Apache, a Node.js server, or another web server is using port 80.
  • A previous Nginx process did not shut down cleanly and the socket is in TIME_WAIT.
  • Systemd socket activation is holding the port.
  • A Docker container bound to port 80 is running on the host network.

How to Fix It

1. Identify the process using the port

sudo ss -tlnp | grep :80

or

sudo lsof -i :80

2. Stop or kill the conflicting process

sudo systemctl stop apache2
sudo systemctl stop nginx
sudo kill <PID>

3. Start Nginx cleanly

sudo systemctl start nginx

4. Use a different port temporarily

Edit /etc/nginx/sites-enabled/default and change:

listen 8080 default_server;

Then restart:

sudo systemctl restart nginx

5. Check for lingering Nginx processes

ps aux | grep nginx
sudo killall nginx

FAQ

How do I prevent this error on system reboot?
Disable the conflicting service from auto-starting: sudo systemctl disable apache2. Ensure Nginx is enabled: sudo systemctl enable nginx.
What does the error code 98 mean?
Error code 98 corresponds to EADDRINUSE. It is a standard POSIX error code meaning the port is already in use by another process. The OS will not allow two processes to bind to the same address and port simultaneously.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro