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

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


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


[::]: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


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