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 :80or
sudo lsof -i :802. Stop or kill the conflicting process
sudo systemctl stop apache2
sudo systemctl stop nginx
sudo kill <PID>3. Start Nginx cleanly
sudo systemctl start nginx4. Use a different port temporarily
Edit /etc/nginx/sites-enabled/default and change:
listen 8080 default_server;Then restart:
sudo systemctl restart nginx5. Check for lingering Nginx processes
ps aux | grep nginx
sudo killall nginxFAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro