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

ID : 10088

viewed : 59

Tags : ubuntunginxubuntu

Top 5 Answer for ubuntu - nginx - nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

vote vote

95

i fixed this by running sudo apachectl stop - turns out apache was running in the background and prevented nginx from starting on the desired port.

On ubuntu run sudo /etc/init.d/apache2 stop

vote vote

88

[::]:80 is a ipv6 address.

This error can be caused if you have a nginx configuration that is listening on port 80 and also on port [::]:80.

I had the following in my default sites-available file:

listen 80; listen [::]:80 default_server; 

You can fix this by adding ipv6only=on to the [::]:80 like this:

listen 80; listen [::]:80 ipv6only=on default_server; 

For more information, see:

http://forum.linode.com/viewtopic.php?t=8580

http://wiki.nginx.org/HttpCoreModule#listen

vote vote

72

My case is different, I had to kill running Nginx to restart it.

Instead of

sudo systemctl restart nginx 

I had to use:

sudo pkill -f nginx & wait $! sudo systemctl start nginx 
vote vote

60

I found the issue that I never had before.

I just had to delete /etc/nginx/sites-available/default. Then it worked.

This deletion will delete the symlink only, As backup you can find default file in /etc/nginx/sites-enabled/default

My conf was in /etc/nginx/default.

vote vote

57

I was also getting the same error.

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

and when i typed the localhost in the browser, then i was getting

It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet. instead of nginx welcome page, apache2 is running on the same port,

  1. find the apache2 ports.conf file

    sudo /etc/apache2/ports.conf 
  2. change the port other then 80 , i make it as 70

  3. save the file

  4. restart your system

it will works for you also, if you type the localhost in the browser, you will get nginx welcome page

Top 3 video Explaining ubuntu - nginx - nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

Related QUESTION?