nginx startup_error ai_generated true

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

ID: nginx/bind-address-in-use

Also available as: JSON · Markdown
92%Fix Rate
92%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1 active

Root Cause

Port 80/443 already in use by another process. Another nginx instance, Apache, or a container.

generic

Workarounds

  1. 95% success Find and stop the conflicting process
    sudo ss -tlnp | grep :80  # or: sudo lsof -i :80

    Sources: https://nginx.org/en/docs/

  2. 90% success Use nginx -s stop to stop the existing nginx
    sudo nginx -s stop && sudo nginx
  3. 85% success Check for and stop Apache if installed alongside nginx
    sudo systemctl stop apache2 && sudo systemctl disable apache2

Dead Ends

Common approaches that don't work:

  1. Change nginx to a different port like 8080 65% fail

    Clients expect 80/443. Changing ports requires all URLs and redirects to be updated.

  2. Use kill -9 on the process using the port 68% fail

    kill -9 does not allow graceful shutdown; may corrupt logs or leave connections hanging. Use graceful stop.