I recently installed Nginx on ubuntu, and I want to run it, so i use the nginx command, but I got this error.
root@kevin-virtual-machine:/etc/nginx# nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] still could not bind()
root@kevin-virtual-machine:/etc/nginx#
Ii haven’t done anything, I just installed it and it doesn’t work.
I tried searching for the solution, but I haven’t found one yet.
2
Answers
I solved it by killing the Nginx processes. Here is what I did:
I get the process ID's of every Nginx process.
pgrep nginx
Then I kill every process, given the process ID
kill [process id]
Then I restarted nginx
sudo service nginx restart
Try these commands
Restart nginx
Find errors in the script :
If none of them worked, try using port 8080 instead of port 80.