无法在 ubuntu 上卸载并安装 nginx

无法在 ubuntu 上卸载并安装 nginx

sudo apt-get install nginx -y运行安装 nginx时失败,错误如下:-

vinay@vinay-VirtualBox:/etc$ sudo apt-get install nginx -y
Reading package lists... Done
Building dependency tree... 0%
Building dependency tree       
Reading state information... Done
nginx is already the newest version (1.9.15-0ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up nginx-light (1.9.15-0ubuntu1) ...
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 2017-12-14 16:44:02 IST; 6ms ago
  Process: 23976 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Dec 14 16:44:02 vinay-VirtualBox systemd[1]: Starting A high performance web server and a reverse proxy server...
Dec 14 16:44:02 vinay-VirtualBox nginx[23976]: nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
Dec 14 16:44:02 vinay-VirtualBox nginx[23976]: nginx: configuration file /etc/nginx/nginx.conf test failed
Dec 14 16:44:02 vinay-VirtualBox systemd[1]: nginx.service: Control process exited, code=exited status=1
Dec 14 16:44:02 vinay-VirtualBox systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Dec 14 16:44:02 vinay-VirtualBox systemd[1]: nginx.service: Unit entered failed state.
Dec 14 16:44:02 vinay-VirtualBox systemd[1]: nginx.service: Failed with result 'exit-code'.
dpkg: error processing package nginx-light (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
 nginx depends on nginx-core (>= 1.9.15-0ubuntu1) | nginx-full (>= 1.9.15-0ubuntu1) | nginx-light (>= 1.9.15-0ubuntu1) | nginx-extras (>= 1.9.15-0ubuntu1); however:
  Package nginx-core is not installed.
  Package nginx-full is not installed.
  Package nginx-light is not configured yet.
  Package nginx-extras is not installed.
 nginx depends on nginx-core (<< 1.9.15-0ubuntu1.1~) | nginx-full (<< 1.9.15-0ubuntu1.1~) | nginx-light (<< 1.9.15-0ubuntu1.1~) | nginx-extras (<< 1.9.15-0ubuntu1.1~); however:
  Package nginx-core is not installed.
  Package nginx-full is not installed.
  Package nginx-light is not configured yet.
  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-light
 nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)

任何立即的帮助都是值得的。

答案1

如果你正确阅读了错误,你会发现有解决问题的线索。says nginx is already is in its new version另一部分还提到了一些依赖关系。

这是你可以尝试的。

sudo apt-get update- 更新你的软件包

sudo apt-get purge nginx删除所有已安装的 nginx 部分。

sudo apt-get install nginx nginx-core nginx-common最后这应该可以工作。

相关内容