无法在 Amazon Lightsail NodeJs 机器上安装 nginx

无法在 Amazon Lightsail NodeJs 机器上安装 nginx

尝试安装 nginx 时出现以下错误。

我已经在机器上托管了一个 reactjs 应用程序,并打算使用 nginx 设置反向代理

Reading package lists... Done
Building dependency tree
Reading state information... Done
nginx is already the newest version (1.10.3-0ubuntu0.16.04.3).
The following packages were automatically installed and are no longer required:
  libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 22 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up nginx-core (1.10.3-0ubuntu0.16.04.3) ...
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 Tue 2018-12-18 13:41:07 IST; 4ms ago
  Process: 10014 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Dec 18 13:41:07 -systemd[1]: Starting A high performance web s....
Dec 18 13:41:07  nginx[10014]: nginx: [emerg] unknown directiv...8
Dec 18 13:41:07  nginx[10014]: nginx: configuration file /etc/...d
Dec 18 13:41:07  systemd[1]: nginx.service: Control process ex...1
Dec 18 13:41:07  systemd[1]: Failed to start A high performanc....
Dec 18 13:41:07  systemd[1]: nginx.service: Unit entered faile....
Dec 18 13:41:07  systemd[1]: nginx.service: Failed with result....
Hint: Some lines were ellipsized, use -l to show in full.
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.3) | nginx-full (>= 1.10.3-0ubuntu0.16.04.3) | nginx-light (>= 1.10.3-0ubuntu0.16.04.3) | nginx-extras (>= 1.10.3-0ubuntu0.16.04.3); 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.3.1~) | nginx-full (<< 1.10.3-0ubuntu0.16.04.3.1~) | nginx-light (<< 1.10.3-0ubuntu0.16.04.3.1~) | nginx-extras (<< 1.10.3-0ubuntu0.16.04.3.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
No apport report written because the error message indicates its a followup error from a previous failure.
                          Errors were encountered while processing:
 nginx-core
 nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

一些建议:安装前请确保没有其他 Web 服务器正在运行。卸载 Nginx 及其配置文件。从官方 Nginx 存储库安装 Nginx(尽管这不是必须的)。

相关内容