All of a sudden I am getting the below nginx error
* Restarting nginx
* Stopping nginx nginx
...done.
* Starting nginx nginx
nginx: [emerg] bind() to [
To follow on to @lfender6445 and @SAURABH answers --
My problem was also the fact that after upgrading to Vagrant 2.2.2 Apache2 was running as a web server when the guest booted. In the past I only had nginx as a web server.
vagrant ssh into the box and run the following command to disable Apache2 from starting up whenever the guest box boots:
sudo update-rc.d -f apache2 remove
Exit ssh, vagrant halt, vagrant up. Problem solved.
I had this error on AWS Lightsail, used the top answer above
from
listen [::]:80;
to
listen [::]:80 ipv6only=on default_server;
and then click on "reboot" button inside my AWS account, I have main server Apache and Nginx as proxy.
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,
find the apache2 ports.conf file
sudo /etc/apache2/ports.conf
change the port other then 80
, i make it as 70
save the file
restart your system
it will works for you also, if you type the localhost in the browser, you will get nginx welcome page
[::]: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
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
.
I use supervisor to run Nginx and Gunicorn side by side on a Docker container.
This was the configuration used for supervisor :
[supervisord]
nodaemon=true
[program:gunicorn]
command = /project/start.sh
user = www-data
[program:nginx]
command=/usr/sbin/nginx
The problem was how I launched Ngnix : by default it runs on the foreground. This makes supervise retry to run another instance of Nginx.
By adding -g 'daemon off;'
to the command line, Nginx stayed in the foreground, supervisor stopped trying to run another instance.