首页 文章

Nginx在启动时崩溃

提问于
浏览
0

我使用"apk add nginx"在alpine上安装了nginx . 出于某种原因系统启动时 . Nginx崩溃了 . 我检查了/var/log/nginx/error.logs中的日志,这是输出:

2016/07/27 12:54:59 [emerg] 7944#0: bind() to 0.0.0.0:80 failed (98: Address in use)
    2016/07/27 12:54:59 [emerg] 7944#0: bind() to 0.0.0.0:8080 failed (98: Address in use)
    2016/07/27 12:54:59 [emerg] 7944#0: still could not bind()

当我使用sudo netstat -nltup | grep:80

tcp    0      0 127.0.0.1:80            0.0.0.0:* LISTEN  5264/nginx.conf
    tcp    0      0 0.0.0.0:8080            0.0.0.0:*    LISTEN    5033/nginx.conf
    tcp    0      0 :::80                   :::*   LISTEN    5033/nginx.conf

我使用sudo fuser -k 8080 / tcp在8080处杀死了进程 . 杀死的进程的ID是5033 5040.即使在那之后我运行sudo服务nginx启动 . 给我同样的错误:

* Starting nginx ...
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
    nginx: [emerg] still could not bind()
    * start-stop-daemon: failed to start `/usr/sbin/nginx'
    * Failed to start nginx                                                                    
    * ERROR: nginx failed to start

1 回答

  • 0

    这是快速修复,如果你想让你的Nginx现在工作,但这不是永久的解决方案,如果你重新启动服务器然后再次运行相同的命令再次获得nginx .

    这将杀死PORT 98进程

    fuser -k 98/tcp
    service nginx start
    

相关问题