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

前端 未结 18 1356
醉酒成梦
醉酒成梦 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: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.

提交回复
热议问题