skip to Main Content

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


  1. Chosen as BEST ANSWER

    I solved it by killing the Nginx processes. Here is what I did:

    1. I get the process ID's of every Nginx process.

      pgrep nginx

    2. Then I kill every process, given the process ID

      kill [process id]

    3. Then I restarted nginx

      sudo service nginx restart


  2. Try these commands

    sudo netstat -tuln | grep :80 # This is for finding confilicts in the same port
    

    Restart nginx

    sudo systemctl stop nginx
    

    Find errors in the script :

    sudo nginx -t
    

    If none of them worked, try using port 8080 instead of port 80.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search