【发布时间】:2016-12-07 07:44:59
【问题描述】:
我已经使用“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 service nginx start 时。给我同样的错误:
* 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
【问题讨论】:
-
所以你杀死了 :8080 进程而不是 :80 ?
-
您使用什么操作系统和控制面板?
-
检查
/etc/nginx/sites-enabled中的配置 -
@ringø 没有名为 sites-enabled 的文件夹。我什至尝试在 8080 和 80 处杀死两个进程并重新启动服务 nginx。还是不行。