Não é possível desinstalar e instalar o nginx no Ubuntu

0

Ao executar sudo apt-get install nginx -y para instalar o nginx. Ele falha com erro abaixo: -

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)

Qualquer ajuda imidial valeria a pena.

    
por Vinay Prajapati 14.12.2017 / 12:18

1 resposta

1

Se você ler o erro corretamente, descobrirá que há pistas para solucionar o problema. says nginx is already is in its new version , outra parte também menciona algumas dependências.

Isso é o que você pode tentar.

sudo apt-get update - atualize seus pacotes

sudo apt-get purge nginx para remover qualquer parte do nginx já instalada.

sudo apt-get install nginx nginx-core nginx-common finalmente, isso deve funcionar.

    
por saviour123 14.12.2017 / 12:25