我想摆脱 nginx,因为它给我的 apt-get 带来了麻烦,但我无法摆脱它,我不断收到:
$ sudo apt remove nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'nginx' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
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 Tue 2018-05-22 06:49:55 PDT; 5ms ago
Process: 30212 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Process: 30208 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
May 22 06:49:54 regDesktopHome nginx[30212]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
May 22 06:49:54 regDesktopHome nginx[30212]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
May 22 06:49:54 regDesktopHome nginx[30212]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
May 22 06:49:55 regDesktopHome nginx[30212]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
May 22 06:49:55 regDesktopHome nginx[30212]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
May 22 06:49:55 regDesktopHome nginx[30212]: nginx: [emerg] still could not bind()
May 22 06:49:55 regDesktopHome systemd[1]: nginx.service: Control process exited, code=exited status=1
May 22 06:49:55 regDesktopHome systemd[1]: Failed to start A high performance web server and a reverse proxy server.
May 22 06:49:55 regDesktopHome systemd[1]: nginx.service: Unit entered failed state.
May 22 06:49:55 regDesktopHome 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
Errors were encountered while processing:
nginx-core
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ 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 Tue 2018-05-22 06:49:55 PDT; 1min 45s ago
Process: 30212 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Process: 30208 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
$ journalctl -xe
Hint: You are currently not seeing messages from other users and the system.
Users in the 'systemd-journal' group can see all messages. Pass -q to
turn off this notice.
No journal files were opened due to insufficient permissions.
$
我该如何解决这个问题?我正在16.04
答案1
在这个解决方案中,我假设您已经从包中安装了 nginx(而不是从源代码中安装了)。
获取已安装软件包(如“nginx”)的列表:sudo apt list --installed 2>/dev/null |grep -i 'nginx'
查看此列表并删除软件包。“nginx”有多个软件包:nginx、nginx-extras、nginx-full、nginx-light 等。
第一个命令将显示您的系统上有哪些具体的 nginx 包。然后您可以继续删除它/它们。