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

Valic —  April 15, 2013 — 2 Comments

Few days ago I had to deal with this error when I wanted to restart my Nginx Web Server:

/etc/init.d/nginx restart
Stopping nginx:                                            [FAILED]
Starting nginx: 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)
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)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
[FAILED]

After some internet searches, I’ve found the fix:

fuser -  Is displaying the PIDs of processes that are using the specified files or file systems.

Then you need to search what PID (process ID) is using the 80 port by typing the following command:

fuser -n tcp 80
80/tcp:                459   465   477

Now just kill those processes:

kill -9 459
kill -9 465
kill -9 477

Then just restart Nginx

/etc/init.d/nginx restart

Valic

Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

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

  1. I have the same “problem” but after each reboot, I have to apply the same again. I have found no fix as of yet. Ideas?

    However, instead of killing the processes one by one, just apply fuser -k 80/tcp. Cheers.

  2. This means that you have another server or application that is using port 80. eg: apache, skype

Leave a Reply