每次我运行时sudo apt-get update
都会抛出有关 nginx 的错误。
The following NEW packages will be installed:
nginx
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
1 not fully installed or removed.
Need to get 0 B/3.498 B of archives.
After this operation, 37,9 kB of additional disk space will be used.
Selecting previously unselected package nginx.
(Reading database ... 542828 files and directories currently installed.)
Preparing to unpack .../nginx_1.10.0-0ubuntu0.16.04.4_all.deb ...
Unpacking nginx (1.10.0-0ubuntu0.16.04.4) ...
Setting up nginx-full (1.10.0-0ubuntu0.16.04.4) ...
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.
dpkg: error processing package nginx-full (--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.0-0ubuntu0.16.04.4) | nginx-full (>= 1.10.0-0ubuntu0.16.04.4) | nginx-light (>= 1.10.0-0ubuntu0.16.04.4) | nginx-extras (>= 1.10.0-0ubuntu0.16.04.4); however:
Package nginx-core is not installed.
Package nginx-full is not configured yet.
Package nginx-light is not installed.
Package nginx-extras is not installed.
nginx depends on nginx-core (<< 1.10.0-0ubuntu0.16.04.4.1~) | nginx- full (<< 1.10.0-0ubuntu0.16.04.4.1~) | nginx-light (<< 1.10.0- 0ubuntu0.16.04.4.1~) | nginx-extras (<< 1.10.0-0ubuntu0.16.04.4.1~); however:
Package nginx-core is not installed.
Package nginx-full is not configured yet.
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-full
nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)
我尝试按照其他帖子中的建议解决,但没有成功:
sudo apt-get remove nginx
sudo apt-get -f install # (as mentioned in this post)
$ systemctl status nginx.service
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 Mo 2016-11-07 21:05:51 CET; 7min ago
Process: 10372 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
我也尝试了以下操作...因为错误仍然存在。
apt purge nginx
apt autoremove
apt install nginx
从现在起,我还有多少选择可以走上正确的道路?
我应该尝试卸载/禁用 apache2 吗?
答案1
在安装 nginx 之前先关闭 apache2 应该可以解决这个问题。
停止 apache2
sudo systemctl stop apache2.service
防止 apache2 在启动时启动
sudo systemctl disable apache2.service
重新安装 nginx
sudo apt-get install nginx