web-dev-qa-db-ja.com

ubuntu 16.04にnginxをインストールできません

私は、ほとんど解決されていない同様の質問を見てきました。 Apacheサーバーを停止した後、nginxをインストールしています

dpkg:パッケージnginx-coreの処理中のエラー(--configure):インストール後のサブプロセスがインストールされたサブプロセスがエラー終了ステータス1を返しました

$ sudo apt install nginx

Reading package lists... Done
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 25 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.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.
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.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 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.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 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)

「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: en
   Active: failed (Result: exit-code) since Fri 2017-05-26 12:50:30 IST; 3min 27
  Process: 21570 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (cod
  Process: 21566 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process

May 26 12:50:28 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:28 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:29 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:29 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:30 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:30 infinity nginx[21570]: nginx: [emerg] still could not bind()
May 26 12:50:30 infinity systemd[1]: nginx.service: Control process exited, code
May 26 12:50:30 infinity systemd[1]: Failed to start A high performance web serv
May 26 12:50:30 infinity systemd[1]: nginx.service: Unit entered failed state.
May 26 12:50:30 infinity systemd[1]: nginx.service: Failed with result 'exit-cod
lines 1-16/16 (END)

「journalctl -xe」を実行した後の出力

-- 
-- Unit nginx.service has begun starting up.
May 26 12:50:28 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:28 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:29 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:29 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:30 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:30 infinity nginx[21570]: nginx: [emerg] still could not bind()
May 26 12:50:30 infinity systemd[1]: nginx.service: Control process exited, code
May 26 12:50:30 infinity systemd[1]: Failed to start A high performance web serv
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit nginx.service has failed.
-- 
-- The result is failed.
May 26 12:50:30 infinity systemd[1]: nginx.service: Unit entered failed state.
May 26 12:50:30 infinity systemd[1]: nginx.service: Failed with result 'exit-cod
May 26 12:50:32 infinity Sudo[21514]: pam_unix(Sudo:session): session closed for
May 26 12:50:48 infinity pkexec[21608]: pam_unix(polkit-1:session): session open
May 26 12:50:48 infinity pkexec[21608]: pam_systemd(polkit-1:session): Cannot cr
May 26 12:50:48 infinity pkexec[21608]: mayuresh: Executing command [USER=root] 
lines 2095-2117/2117 (END)
1
YSsdatasks

私はついにnginxをインストールすることができました:Apache2をアンインストールし、dpkgを再インストールしました この回答

1
YSsdatasks