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

前端 未结 18 1317
醉酒成梦
醉酒成梦 2020-11-28 17:36

All of a sudden I am getting the below nginx error

 * Restarting nginx
 * Stopping nginx nginx
   ...done.
 * Starting nginx nginx
nginx: [emerg] bind() to [         


        
相关标签:
18条回答
  • 2020-11-28 18:09

    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.

    0 讨论(0)
  • 2020-11-28 18:09

    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.

    0 讨论(0)
  • 2020-11-28 18:11

    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

    0 讨论(0)
  • 2020-11-28 18:13

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

    0 讨论(0)
  • 2020-11-28 18:13

    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.

    0 讨论(0)
  • 2020-11-28 18:14

    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.

    0 讨论(0)
提交回复
热议问题