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

Today trying to configure my nginx and got this strange error :

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

which is strange cause i remember that i got no other program using that port, the solution is simple :

sudo fuser -k 80/tcp

This will kill process on port 80, and then try starting nginx again:

service nginx start

 

PS : incase you also got

 [emerg] 10523#0: bind() to 0.0.0.0:443 failed (98: Address already in use) 

Kill also process on port 443 before starting nginx again:

sudo fuser -k 443/tcp