首页 > 解决方案 > Dokku:Nginx 失败,地址已在使用中

问题描述

我正在尝试在 AWS 上托管的全新 Ubuntu 16.04 实例上安装 Dokku。连接是通过 ssh。由于 Nginx 错误,安装脚本反复失败。我不熟悉 Nginx,所以我无法解释问题所在。我最初尝试在 Ubuntu 14 上安装。我在那里遇到了同样的错误。Dokku 文档表明 Ubuntu 14 上的 apt 存储库可能存在问题。我按照步骤使用更新的 Nginx 更新了 apt 存储库,但这不起作用。所以我搬到了一个 Ubuntu 16.04 实例。但是,我仍然有这个问题。问题是什么,我该如何解决?谢谢。

Nginx 版本:

$ nginx -v
nginx version: nginx/1.10.3 (Ubuntu)

根据 Dokku 的命令:

wget https://raw.githubusercontent.com/dokku/dokku/v0.12.12/bootstrap.sh 

(没有问题)

sudo DOKKU_TAG=v0.12.12 bash bootstrap.sh 

(导致以下错误)

错误日志如下:

Setting up nginx-core (1.10.3-0ubuntu0.16.04.2) ...
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
invoke-rc.d: initscript nginx, action "start" failed.
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2018-08-16 13:45:02 UTC; 5ms ago
  Process: 23440 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
  Process: 23436 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

Aug 16 13:45:01 nginx[23440]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Aug 16 13:45:01 nginx[23440]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Aug 16 13:45:01 nginx[23440]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Aug 16 13:45:02 nginx[23440]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Aug 16 13:45:02 nginx[23440]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Aug 16 13:45:02  nginx[23440]: nginx: [emerg] still could not bind()
Aug 16 13:45:02  systemd[1]: nginx.service: Control process exited, code=exited status=1
Aug 16 13:45:02  systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Aug 16 13:45:02 systemd[1]: nginx.service: Unit entered failed state.
Aug 16 13:45:02 systemd[1]: nginx.service: Failed with result 'exit-code'.
dpkg: error processing package nginx-core (--configure):
 subprocess installed post-installation script returned error exit status 1
 dpkg: dependency problems prevent configuration of nginx:
 nginx depends on nginx-core (>= 1.10.3-0ubuntu0.16.04.2) | nginx-full (>= 1    .10.3-0ubuntu0.16.04.2) | nginx-light (>= 1.10.3-0ubuntu0.16.04.2) |     nginx-extras (>= 1.10.3-0ubuntu0.16.04.2); however:
  Package nginx-core is not configured yet.
  Package nginx-full is not installed.
  Package nginx-light is not installed.
   Package nginx-extras is not installed.
 nginx depends on nginx-core (<< 1.10.3-0ubuntu0.16.04.2.1~) | nginx-full (<< 1.10.3-0ubuntu0.16.04.2.1~) | nginx-light (<< 1.10.3-0ubuntu0.16.04.2.1~) | nginx-extras (<< 1.10.3-0ubuntu0.16.04.2.1~); however:
  Package nginx-core is not configured yet.
   Package nginx-full is not installed.
   Package nginx-light is not installed.
   Package nginx-extras is not installed.

 dpkg: error processing package nginx (--configure):
 dependency problems - leaving unconfigured
 Setting up cgroupfs-mount (1.2) ...
 No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                               Setting up plugn (0.3.0) ...
Processing triggers for systemd (229-4ubuntu21.2) ...
 Processing triggers for ureadahead (0.100.0-19) ...
 Processing triggers for ufw (0.35-0ubuntu2) ...
Errors were encountered while processing:
 nginx-core
 nginx
 E: Sub-process /usr/bin/dpkg returned an error code (1)

标签: amazon-web-servicesnginxdokku

解决方案


弄清楚了。一些 apache 服务器正在监听端口 80。这个答案显示了如何改变它。

将 apache 配置为侦听 80 以外的端口


推荐阅读