Kanin Peanviriyakulkit
Kanin Peanviriyakulkit

Reputation: 520

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

I try to sudo service nginx restart and it shows this error:

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

I think it is about this symlink?

ln -s ../sites-available/default default

I try

cd /etc/nginx && grep -R listen *

sites-available/default:        listen 80;
sites-enabled/default:        listen 80;

How do I fix it?

Upvotes: 5

Views: 21741

Answers (2)

gitaarik
gitaarik

Reputation: 46300

For me it was because I had lighttpd installed, which was running. Uninstalled it and the problem disappeared.

Upvotes: 0

binhhoang18
binhhoang18

Reputation: 627

You can kill it using:

sudo fuser -k 80/tcp

And then try restarting nginx again:

service nginx start

Upvotes: 11

Related Questions