20

I have some problems to install nginx pkg (nginx-full) on debian jessie

# apt-get install nginx-full
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  nginx-common
Suggested packages:
  fcgiwrap nginx-doc
The following NEW packages will be installed:
  nginx-common nginx-full
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 510 kB of archives.
After this operation, 1.271 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://debian.c3sl.ufpr.br/debian/ jessie/main nginx-common all 1.6.1-1 [83,6 kB]
Get:2 http://debian.c3sl.ufpr.br/debian/ jessie/main nginx-full amd64 1.6.1-1+b1 [427 kB]
Fetched 510 kB in 1s (266 kB/s)     
Selecting previously unselected package nginx-common.
(Reading database ... 170540 files and directories currently installed.)
Preparing to unpack .../nginx-common_1.6.1-1_all.deb ...
Unpacking nginx-common (1.6.1-1) ...
Selecting previously unselected package nginx-full.
Preparing to unpack .../nginx-full_1.6.1-1+b1_amd64.deb ...
Unpacking nginx-full (1.6.1-1+b1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up nginx-common (1.6.1-1) ...
Setting up nginx-full (1.6.1-1+b1) ...
Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript nginx, action "start" failed.
dpkg: error processing package nginx-full (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 nginx-full
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)
   Active: failed (Result: exit-code) since Sex 2014-09-05 11:39:46 BRT; 1s ago
  Process: 2972 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

#journalctl -xn
No journal files were found.

Someone know how to fix it?

  • 1
    Can you add the output of 'systemctl status nginx.service' and 'journalctl -xn' – 0x7c0 Sep 5 '14 at 15:09
  • # systemctl status nginx.service is there, and the journalctl -xn returns "No journal files were found." – gnomex Sep 5 '14 at 16:25
  • I had the same issue, since I installed lighttpd first. It would be great, if nginx would provide a better error message, though @Shutupsquare: for me that output was useless and didn't allow concluding that the port was already blocked... – Chris Feb 25 '15 at 15:40
23

A similar issue was reported on Debian bug #754407. In the end it was just the port 80 being taken by other process (Apache2). Might this be your case as well?

  • Having read the bug, this really should fail more gracefully and informatively. It should also be possible to switch to another port if the current port is in use. I think postgresql does something like this for example. – Faheem Mitha Sep 10 '14 at 22:26
  • The bug has been fixed at version 1.6.1-2. Now, all things work perfectly – gnomex Sep 15 '14 at 12:10
  • @gnomex nope, 1.9.10-1 in Stretch and I had to stop apache2 to install nginx-full. – berbt Feb 28 '16 at 19:30
  • In my case Varnish was using port 80 as I tried to install nginx for 443. Thanks for the tip – NoChecksum Mar 15 '16 at 20:01
14

Stop apache2

service apache2 stop

then install nginx

apt-get install nginx

Then celebrate it!

7

in my case I execute

sudo apt-get remove nginx* --purge after that I install nginx-common

sudo apt-get install nginx-common

then I install nginx

sudo apt-get install nginx

after this I type ip in browser and it worked

0

in my case the error is the server has IPv6 disabled. just edit nginx configuration files to fix ( for example : /etc/nginx/sites-enabled/default ) and restart nginx demon.

0

I had the same problem. I DO NOT have Apache, and nothing else was blocking my port 80. I could NOT install nginx with

sudo apt-get install nginx

nor with

sudo apt-get install nginx-common nginx-full

After one week I stumbled over this little blog: https://etc.banana.fish/?p=75

In this blog, the solution is:

  1. Install nginx-common: sudo apt-get install nginx-common
  2. Remove listen [::]:80 default_server; from /etc/nginx/sites-enabled/default (I made this using the root-user)
  3. Just to be sure, I did reboot my server.
  4. Just to be sure twice, I did sudo apt-get update and then sudo apt-get upgrade.
  5. Now I finally called sudo apt-get install nginx-full and it worked!

Afterwords I could see the Titlescreen of nginx, when I typed in the IP of my remote server!

0

I was having the same problem. The advice about Apache wasn't relevant, as I'd actively uninstalled it during setup.

Turns out I was seeing the result of a conflict between nginx's config file /etc/nginx/nginx.conf and the service script at /lib/systemd/system/nginx.service.

Specifically, the service script was starting nginx with some options, including daemon on:

$ cat /lib/systemd/system/nginx.service
...
[Service]
...
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
...

I ran /usr/sbin/nginx -g 'daemon on; master_process on;' directly on the terminal and got the following error:

nginx: [emerg] "daemon" directive is duplicate in /etc/nginx/nginx.conf:1

I took a look in /etc/nginx/nginx.conf and found (on line 1):

daemon off;

Commenting this out and running sudo apt-get -f install resolved the problem.

0

I encounter this issue when apt-get remove nginx and apt-get automove nginx, and after than I manually remove the nginx folder. When I apt-get install nginx again, this issue comes out.

~# apt-get install  

nginx Reading package lists... Done Building dependency tree Reading state information... Done nginx is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 140 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-full (1.6.2-5+deb8u4) ... Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details. invoke-rc.d: initscript nginx, action "start" failed. dpkg: error processing package nginx-full (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of nginx: nginx depends on nginx-full (>= 1.6.2-5+deb8u4) | nginx-light (>= 1.6.2-5+deb8u4) | nginx-extras (>= 1.6.2-5+deb8u4); however:
Package nginx-full is not configured yet. Package nginx-light is not installed. Package nginx-extras is not installed. nginx depends on nginx-full (<< 1.6.2-5+deb8u4.1~) | nginx-light (<< 1.6.2-5+deb8u4.1~) | nginx-extras (<< 1.6.2-5+deb8u4.1~); however: Package nginx-full is not configured yet. Package nginx-light is not installed.
Package nginx-extras is not installed.

dpkg: error processing package nginx (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: nginx-full nginx E: Sub-process /usr/bin/dpkg returned an error code (1)

and

~# systemctl status nginx.service  

nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled) Active: failed (Result: exit-code) since Tue 2017-03-21 04:35:29 EDT; 1min 33s ago
Process: 19912 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE) Main PID: 18408 (code=exited, status=0/SUCCESS)

Mar 21 04:35:29 dayinhu nginx[19912]: nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory) Mar 21 04:35:29 dayinhu nginx[19912]: nginx: configuration file /etc/nginx/nginx.conf test failed Mar 21 04:35:29 dayinhu systemd[1]: nginx.service: control process exited, code=exited status=1 Mar 21 04:35:29 dayinhu systemd[1]: Failed to start A high performance web server and a reverse proxy server. Mar 21 04:35:29 dayinhu systemd[1]: Unit nginx.service entered failed state.

It's said the nginx.conf lost, I tryed many times with no success.

Finally I fixed by,

apt-get purge nginx nginx-common nginx-full
apt-get install nginx
-2
  1. if you have skype: switch skype port 80 to 443
  2. stop apache2 service
  3. install nginx
  4. restart apache2
  5. apt-get update

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.