1

When running sudo apt-get install nginx -y to install nginx. It fails with error below:-

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)

Any immidiate help would be worth it.

2

If your read your error properly you would find out there are clues to solving the problem. says nginx is already is in its new version, another part also mention some dependencies.

This is what you can try.

sudo apt-get update - update your packages

sudo apt-get purge nginx to remove any pieces of nginx already installed.

sudo apt-get install nginx nginx-core nginx-common finally this should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.