Nginx installation error in Ubuntu 16.04











up vote
43
down vote

favorite
11













:~$ sudo apt-get remove nginx* && sudo apt-get install nginx-full*

Reading package lists... Done
Building dependency tree
Reading state information... Done

After this operation, 5,579 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 nginx-full-dbg amd64 1.10.0-0ubuntu0.16.04.1 [3,789 kB]
Fetched 3,789 kB in 33s (112 kB/s)
Selecting previously unselected package nginx-common.
(Reading database ... 189767 files and directories currently installed.)
Preparing to unpack .../nginx-common_1.10.0-0ubuntu0.16.04.1_all.deb ...
Unpacking nginx-common (1.10.0-0ubuntu0.16.04.1) ...
Selecting previously unselected package nginx-full.
Preparing to unpack .../nginx-full_1.10.0-0ubuntu0.16.04.1_amd64.deb ...
Unpacking nginx-full (1.10.0-0ubuntu0.16.04.1) ...
Selecting previously unselected package nginx-full-dbg.
Preparing to unpack .../nginx-full-dbg_1.10.0-0ubuntu0.16.04.1_amd64.deb ...
Unpacking nginx-full-dbg (1.10.0-0ubuntu0.16.04.1) ...
Processing triggers for ufw (0.35-0ubuntu1) ...
Rules updated for profile 'Apache Full'
Rules updated for profile 'Nginx HTTP'

Processing triggers for systemd (229-4ubuntu4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up nginx-common (1.10.0-0ubuntu0.16.04.1) ...
Setting up nginx-full (1.10.0-0ubuntu0.16.04.1) ...
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-full (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx-full-dbg:
nginx-full-dbg depends on nginx-full (= 1.10.0-0ubuntu0.16.04.1); however:
Package nginx-full is not configured yet.

dpkg: error processing package nginx-full-dbg (--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-full

nginx-full-dbg

E: Sub-process /usr/bin/dpkg returned an error code (1)









share|improve this question
























  • Try apt-get -f install without any package
    – Motte001
    Apr 28 '16 at 9:49










  • already checked ,same error !! Please look: :~$ sudo apt-get -f install nginx-full-dbg depends on nginx-full (= 1.10.0-0ubuntu0.16.04.1); however: Package nginx-full is not configured yet. dpkg: error processing package nginx-full-dbg (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: nginx-full nginx-full-dbg E: Sub-process /usr/bin/dpkg returned an error code (1)
    – Mohit
    Apr 28 '16 at 9:49








  • 1




    Do you have Apache installed and running on port 80 before you're installing nginx? Edit your question to include the output of systemctl -l status nginx as well
    – Thomas Ward
    Apr 29 '16 at 15:01












  • Did you have a different version of nginx installed as well? I see you ran a remove task, but if the older configurations are still around they may break the installation if they have deprecated commands or similar inlcuded.
    – Thomas Ward
    Apr 29 '16 at 15:06










  • See "systemctl status nginx.service" and "journalctl -xe" for details. – Can you please do that and include the output in your question?
    – David Foerster
    Apr 29 '16 at 17:41















up vote
43
down vote

favorite
11













:~$ sudo apt-get remove nginx* && sudo apt-get install nginx-full*

Reading package lists... Done
Building dependency tree
Reading state information... Done

After this operation, 5,579 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 nginx-full-dbg amd64 1.10.0-0ubuntu0.16.04.1 [3,789 kB]
Fetched 3,789 kB in 33s (112 kB/s)
Selecting previously unselected package nginx-common.
(Reading database ... 189767 files and directories currently installed.)
Preparing to unpack .../nginx-common_1.10.0-0ubuntu0.16.04.1_all.deb ...
Unpacking nginx-common (1.10.0-0ubuntu0.16.04.1) ...
Selecting previously unselected package nginx-full.
Preparing to unpack .../nginx-full_1.10.0-0ubuntu0.16.04.1_amd64.deb ...
Unpacking nginx-full (1.10.0-0ubuntu0.16.04.1) ...
Selecting previously unselected package nginx-full-dbg.
Preparing to unpack .../nginx-full-dbg_1.10.0-0ubuntu0.16.04.1_amd64.deb ...
Unpacking nginx-full-dbg (1.10.0-0ubuntu0.16.04.1) ...
Processing triggers for ufw (0.35-0ubuntu1) ...
Rules updated for profile 'Apache Full'
Rules updated for profile 'Nginx HTTP'

Processing triggers for systemd (229-4ubuntu4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up nginx-common (1.10.0-0ubuntu0.16.04.1) ...
Setting up nginx-full (1.10.0-0ubuntu0.16.04.1) ...
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-full (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx-full-dbg:
nginx-full-dbg depends on nginx-full (= 1.10.0-0ubuntu0.16.04.1); however:
Package nginx-full is not configured yet.

dpkg: error processing package nginx-full-dbg (--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-full

nginx-full-dbg

E: Sub-process /usr/bin/dpkg returned an error code (1)









share|improve this question
























  • Try apt-get -f install without any package
    – Motte001
    Apr 28 '16 at 9:49










  • already checked ,same error !! Please look: :~$ sudo apt-get -f install nginx-full-dbg depends on nginx-full (= 1.10.0-0ubuntu0.16.04.1); however: Package nginx-full is not configured yet. dpkg: error processing package nginx-full-dbg (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: nginx-full nginx-full-dbg E: Sub-process /usr/bin/dpkg returned an error code (1)
    – Mohit
    Apr 28 '16 at 9:49








  • 1




    Do you have Apache installed and running on port 80 before you're installing nginx? Edit your question to include the output of systemctl -l status nginx as well
    – Thomas Ward
    Apr 29 '16 at 15:01












  • Did you have a different version of nginx installed as well? I see you ran a remove task, but if the older configurations are still around they may break the installation if they have deprecated commands or similar inlcuded.
    – Thomas Ward
    Apr 29 '16 at 15:06










  • See "systemctl status nginx.service" and "journalctl -xe" for details. – Can you please do that and include the output in your question?
    – David Foerster
    Apr 29 '16 at 17:41













up vote
43
down vote

favorite
11









up vote
43
down vote

favorite
11






11






:~$ sudo apt-get remove nginx* && sudo apt-get install nginx-full*

Reading package lists... Done
Building dependency tree
Reading state information... Done

After this operation, 5,579 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 nginx-full-dbg amd64 1.10.0-0ubuntu0.16.04.1 [3,789 kB]
Fetched 3,789 kB in 33s (112 kB/s)
Selecting previously unselected package nginx-common.
(Reading database ... 189767 files and directories currently installed.)
Preparing to unpack .../nginx-common_1.10.0-0ubuntu0.16.04.1_all.deb ...
Unpacking nginx-common (1.10.0-0ubuntu0.16.04.1) ...
Selecting previously unselected package nginx-full.
Preparing to unpack .../nginx-full_1.10.0-0ubuntu0.16.04.1_amd64.deb ...
Unpacking nginx-full (1.10.0-0ubuntu0.16.04.1) ...
Selecting previously unselected package nginx-full-dbg.
Preparing to unpack .../nginx-full-dbg_1.10.0-0ubuntu0.16.04.1_amd64.deb ...
Unpacking nginx-full-dbg (1.10.0-0ubuntu0.16.04.1) ...
Processing triggers for ufw (0.35-0ubuntu1) ...
Rules updated for profile 'Apache Full'
Rules updated for profile 'Nginx HTTP'

Processing triggers for systemd (229-4ubuntu4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up nginx-common (1.10.0-0ubuntu0.16.04.1) ...
Setting up nginx-full (1.10.0-0ubuntu0.16.04.1) ...
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-full (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx-full-dbg:
nginx-full-dbg depends on nginx-full (= 1.10.0-0ubuntu0.16.04.1); however:
Package nginx-full is not configured yet.

dpkg: error processing package nginx-full-dbg (--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-full

nginx-full-dbg

E: Sub-process /usr/bin/dpkg returned an error code (1)









share|improve this question
















:~$ sudo apt-get remove nginx* && sudo apt-get install nginx-full*

Reading package lists... Done
Building dependency tree
Reading state information... Done

After this operation, 5,579 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 nginx-full-dbg amd64 1.10.0-0ubuntu0.16.04.1 [3,789 kB]
Fetched 3,789 kB in 33s (112 kB/s)
Selecting previously unselected package nginx-common.
(Reading database ... 189767 files and directories currently installed.)
Preparing to unpack .../nginx-common_1.10.0-0ubuntu0.16.04.1_all.deb ...
Unpacking nginx-common (1.10.0-0ubuntu0.16.04.1) ...
Selecting previously unselected package nginx-full.
Preparing to unpack .../nginx-full_1.10.0-0ubuntu0.16.04.1_amd64.deb ...
Unpacking nginx-full (1.10.0-0ubuntu0.16.04.1) ...
Selecting previously unselected package nginx-full-dbg.
Preparing to unpack .../nginx-full-dbg_1.10.0-0ubuntu0.16.04.1_amd64.deb ...
Unpacking nginx-full-dbg (1.10.0-0ubuntu0.16.04.1) ...
Processing triggers for ufw (0.35-0ubuntu1) ...
Rules updated for profile 'Apache Full'
Rules updated for profile 'Nginx HTTP'

Processing triggers for systemd (229-4ubuntu4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up nginx-common (1.10.0-0ubuntu0.16.04.1) ...
Setting up nginx-full (1.10.0-0ubuntu0.16.04.1) ...
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-full (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx-full-dbg:
nginx-full-dbg depends on nginx-full (= 1.10.0-0ubuntu0.16.04.1); however:
Package nginx-full is not configured yet.

dpkg: error processing package nginx-full-dbg (--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-full

nginx-full-dbg

E: Sub-process /usr/bin/dpkg returned an error code (1)






server dpkg 16.04 webserver nginx






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 29 '16 at 17:22









subodh007

350112




350112










asked Apr 28 '16 at 9:42









Mohit

3191411




3191411












  • Try apt-get -f install without any package
    – Motte001
    Apr 28 '16 at 9:49










  • already checked ,same error !! Please look: :~$ sudo apt-get -f install nginx-full-dbg depends on nginx-full (= 1.10.0-0ubuntu0.16.04.1); however: Package nginx-full is not configured yet. dpkg: error processing package nginx-full-dbg (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: nginx-full nginx-full-dbg E: Sub-process /usr/bin/dpkg returned an error code (1)
    – Mohit
    Apr 28 '16 at 9:49








  • 1




    Do you have Apache installed and running on port 80 before you're installing nginx? Edit your question to include the output of systemctl -l status nginx as well
    – Thomas Ward
    Apr 29 '16 at 15:01












  • Did you have a different version of nginx installed as well? I see you ran a remove task, but if the older configurations are still around they may break the installation if they have deprecated commands or similar inlcuded.
    – Thomas Ward
    Apr 29 '16 at 15:06










  • See "systemctl status nginx.service" and "journalctl -xe" for details. – Can you please do that and include the output in your question?
    – David Foerster
    Apr 29 '16 at 17:41


















  • Try apt-get -f install without any package
    – Motte001
    Apr 28 '16 at 9:49










  • already checked ,same error !! Please look: :~$ sudo apt-get -f install nginx-full-dbg depends on nginx-full (= 1.10.0-0ubuntu0.16.04.1); however: Package nginx-full is not configured yet. dpkg: error processing package nginx-full-dbg (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: nginx-full nginx-full-dbg E: Sub-process /usr/bin/dpkg returned an error code (1)
    – Mohit
    Apr 28 '16 at 9:49








  • 1




    Do you have Apache installed and running on port 80 before you're installing nginx? Edit your question to include the output of systemctl -l status nginx as well
    – Thomas Ward
    Apr 29 '16 at 15:01












  • Did you have a different version of nginx installed as well? I see you ran a remove task, but if the older configurations are still around they may break the installation if they have deprecated commands or similar inlcuded.
    – Thomas Ward
    Apr 29 '16 at 15:06










  • See "systemctl status nginx.service" and "journalctl -xe" for details. – Can you please do that and include the output in your question?
    – David Foerster
    Apr 29 '16 at 17:41
















Try apt-get -f install without any package
– Motte001
Apr 28 '16 at 9:49




Try apt-get -f install without any package
– Motte001
Apr 28 '16 at 9:49












already checked ,same error !! Please look: :~$ sudo apt-get -f install nginx-full-dbg depends on nginx-full (= 1.10.0-0ubuntu0.16.04.1); however: Package nginx-full is not configured yet. dpkg: error processing package nginx-full-dbg (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: nginx-full nginx-full-dbg E: Sub-process /usr/bin/dpkg returned an error code (1)
– Mohit
Apr 28 '16 at 9:49






already checked ,same error !! Please look: :~$ sudo apt-get -f install nginx-full-dbg depends on nginx-full (= 1.10.0-0ubuntu0.16.04.1); however: Package nginx-full is not configured yet. dpkg: error processing package nginx-full-dbg (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: nginx-full nginx-full-dbg E: Sub-process /usr/bin/dpkg returned an error code (1)
– Mohit
Apr 28 '16 at 9:49






1




1




Do you have Apache installed and running on port 80 before you're installing nginx? Edit your question to include the output of systemctl -l status nginx as well
– Thomas Ward
Apr 29 '16 at 15:01






Do you have Apache installed and running on port 80 before you're installing nginx? Edit your question to include the output of systemctl -l status nginx as well
– Thomas Ward
Apr 29 '16 at 15:01














Did you have a different version of nginx installed as well? I see you ran a remove task, but if the older configurations are still around they may break the installation if they have deprecated commands or similar inlcuded.
– Thomas Ward
Apr 29 '16 at 15:06




Did you have a different version of nginx installed as well? I see you ran a remove task, but if the older configurations are still around they may break the installation if they have deprecated commands or similar inlcuded.
– Thomas Ward
Apr 29 '16 at 15:06












See "systemctl status nginx.service" and "journalctl -xe" for details. – Can you please do that and include the output in your question?
– David Foerster
Apr 29 '16 at 17:41




See "systemctl status nginx.service" and "journalctl -xe" for details. – Can you please do that and include the output in your question?
– David Foerster
Apr 29 '16 at 17:41










7 Answers
7






active

oldest

votes

















up vote
117
down vote













Shutting down apache2 first before installing nginx should fix this problem:



sudo service apache2 stop





share|improve this answer



















  • 3




    Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.)
    – David Foerster
    Jul 31 '16 at 14:46






  • 1




    That worked, thanks !!
    – varunkr
    Dec 8 '16 at 11:08










  • This gave me the hint I needed. In my case I was using a docker container which run another nginx server
    – mithril_knight
    Feb 15 '17 at 12:51










  • I hit the same thing, but finding the culprit with netstat -tulpn | grep :80, in my case it was Varnish configured to listen on port 80. systemctl stop varnish, then installing Nginx, fixed it for me. Why Debian/Ubuntu packages try to start themselves on install is beyond me... I would rather install, configure it how I like it, then start it :P
    – geerlingguy
    Jul 26 '17 at 13:57


















up vote
26
down vote













Andrew Chan provided the right answer for me. To extend his answer a bit, here's what you can do on the commandline;



stop apache2



sudo systemctl stop apache2.service



prevent apache2 to start at boot



sudo systemctl disable apache2.service



Reinstall nginx



sudo apt-get install nginx






share|improve this answer



















  • 1




    I would suggest that you not disable Apache2 at boot if you need it - there are many cases where you do not need to disable Apache if you end up configuring it to listen on another port. Having done this myself, for some setups, I can speak from some experience (I also do a lot of work in the nginx package, which is where this experience comes from)
    – Thomas Ward
    Aug 2 '16 at 15:09


















up vote
7
down vote













I just had this issue, but the solution was slightly different.



Once I solved a simple site misconfiguration, I was able to update nginx.



Check your nginx error log:




sudo cat /var/log/nginx/error.log|less




Then try again:




sudo apt-get update;sudo apt-get upgrade







share|improve this answer





















  • logs FTW, in my case the 80 port was already in use which was the cause of error
    – xliiv
    Jun 30 '17 at 18:47


















up vote
5
down vote













In my case the error is the server has IPv6 disabled.
Solution:



Edit /etc/nginx/sites-enabled/default and comment IPv6 out:



listen [::]:80 default_server;


Reinstall nginx:



apt purge nginx
apt autoremove
apt install nginx





share|improve this answer























  • @DavidFoerster With apt 1.0, a new binary was introduced that collects many of the familiar (sub-)commands that were distributed among apt-get, apt-cache and so forth. For example, apt update equals apt-get update, apt search some-name equals apt-cache search some-name and so forth. In some cases, there has been some rewording, like apt full-upgrade that equals apt-get dist-upgrade. The old binaries and their commands are still available for those who fancy them, as well.
    – Henning Kockerbeck
    Oct 27 '16 at 15:04










  • @HenningKockerbeck: Thanks. I truly didn't know back then and thought it was a typo but I educated myself in the mean time.
    – David Foerster
    Oct 27 '16 at 17:51










  • Worked for me, but I can't implement this in my shell scripts for server deployment, that's ridiculously roundabout...
    – Menasheh
    Feb 15 '17 at 6:09


















up vote
1
down vote













When I checked /var/log/nginx/error.log I saw that the installer was unable to open /var/cache/nginx/microcache



A directory listing showed there was no /var/cache/nginx directory, so I created it and the install succeeded.






share|improve this answer




























    up vote
    1
    down vote













    In my case it has been a misconfigurated file in /etc/nginx/sites-enabled/
    I named them as .old files, but that does not matter. They will be readed and may prevend an successfull installation or start of that service.
    Be careful with files in that folder and read your error output carefully as discribed by @Taiger






    share|improve this answer




























      up vote
      0
      down vote













      Before the installation remove any manually added symlinks from /sites-enabled.






      share|improve this answer























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "89"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f764222%2fnginx-installation-error-in-ubuntu-16-04%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        7 Answers
        7






        active

        oldest

        votes








        7 Answers
        7






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        117
        down vote













        Shutting down apache2 first before installing nginx should fix this problem:



        sudo service apache2 stop





        share|improve this answer



















        • 3




          Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.)
          – David Foerster
          Jul 31 '16 at 14:46






        • 1




          That worked, thanks !!
          – varunkr
          Dec 8 '16 at 11:08










        • This gave me the hint I needed. In my case I was using a docker container which run another nginx server
          – mithril_knight
          Feb 15 '17 at 12:51










        • I hit the same thing, but finding the culprit with netstat -tulpn | grep :80, in my case it was Varnish configured to listen on port 80. systemctl stop varnish, then installing Nginx, fixed it for me. Why Debian/Ubuntu packages try to start themselves on install is beyond me... I would rather install, configure it how I like it, then start it :P
          – geerlingguy
          Jul 26 '17 at 13:57















        up vote
        117
        down vote













        Shutting down apache2 first before installing nginx should fix this problem:



        sudo service apache2 stop





        share|improve this answer



















        • 3




          Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.)
          – David Foerster
          Jul 31 '16 at 14:46






        • 1




          That worked, thanks !!
          – varunkr
          Dec 8 '16 at 11:08










        • This gave me the hint I needed. In my case I was using a docker container which run another nginx server
          – mithril_knight
          Feb 15 '17 at 12:51










        • I hit the same thing, but finding the culprit with netstat -tulpn | grep :80, in my case it was Varnish configured to listen on port 80. systemctl stop varnish, then installing Nginx, fixed it for me. Why Debian/Ubuntu packages try to start themselves on install is beyond me... I would rather install, configure it how I like it, then start it :P
          – geerlingguy
          Jul 26 '17 at 13:57













        up vote
        117
        down vote










        up vote
        117
        down vote









        Shutting down apache2 first before installing nginx should fix this problem:



        sudo service apache2 stop





        share|improve this answer














        Shutting down apache2 first before installing nginx should fix this problem:



        sudo service apache2 stop






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 19 '17 at 14:27









        Spl2nky

        1135




        1135










        answered Jun 18 '16 at 1:01









        Andrew Chan

        1,171133




        1,171133








        • 3




          Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.)
          – David Foerster
          Jul 31 '16 at 14:46






        • 1




          That worked, thanks !!
          – varunkr
          Dec 8 '16 at 11:08










        • This gave me the hint I needed. In my case I was using a docker container which run another nginx server
          – mithril_knight
          Feb 15 '17 at 12:51










        • I hit the same thing, but finding the culprit with netstat -tulpn | grep :80, in my case it was Varnish configured to listen on port 80. systemctl stop varnish, then installing Nginx, fixed it for me. Why Debian/Ubuntu packages try to start themselves on install is beyond me... I would rather install, configure it how I like it, then start it :P
          – geerlingguy
          Jul 26 '17 at 13:57














        • 3




          Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.)
          – David Foerster
          Jul 31 '16 at 14:46






        • 1




          That worked, thanks !!
          – varunkr
          Dec 8 '16 at 11:08










        • This gave me the hint I needed. In my case I was using a docker container which run another nginx server
          – mithril_knight
          Feb 15 '17 at 12:51










        • I hit the same thing, but finding the culprit with netstat -tulpn | grep :80, in my case it was Varnish configured to listen on port 80. systemctl stop varnish, then installing Nginx, fixed it for me. Why Debian/Ubuntu packages try to start themselves on install is beyond me... I would rather install, configure it how I like it, then start it :P
          – geerlingguy
          Jul 26 '17 at 13:57








        3




        3




        Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.)
        – David Foerster
        Jul 31 '16 at 14:46




        Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.)
        – David Foerster
        Jul 31 '16 at 14:46




        1




        1




        That worked, thanks !!
        – varunkr
        Dec 8 '16 at 11:08




        That worked, thanks !!
        – varunkr
        Dec 8 '16 at 11:08












        This gave me the hint I needed. In my case I was using a docker container which run another nginx server
        – mithril_knight
        Feb 15 '17 at 12:51




        This gave me the hint I needed. In my case I was using a docker container which run another nginx server
        – mithril_knight
        Feb 15 '17 at 12:51












        I hit the same thing, but finding the culprit with netstat -tulpn | grep :80, in my case it was Varnish configured to listen on port 80. systemctl stop varnish, then installing Nginx, fixed it for me. Why Debian/Ubuntu packages try to start themselves on install is beyond me... I would rather install, configure it how I like it, then start it :P
        – geerlingguy
        Jul 26 '17 at 13:57




        I hit the same thing, but finding the culprit with netstat -tulpn | grep :80, in my case it was Varnish configured to listen on port 80. systemctl stop varnish, then installing Nginx, fixed it for me. Why Debian/Ubuntu packages try to start themselves on install is beyond me... I would rather install, configure it how I like it, then start it :P
        – geerlingguy
        Jul 26 '17 at 13:57












        up vote
        26
        down vote













        Andrew Chan provided the right answer for me. To extend his answer a bit, here's what you can do on the commandline;



        stop apache2



        sudo systemctl stop apache2.service



        prevent apache2 to start at boot



        sudo systemctl disable apache2.service



        Reinstall nginx



        sudo apt-get install nginx






        share|improve this answer



















        • 1




          I would suggest that you not disable Apache2 at boot if you need it - there are many cases where you do not need to disable Apache if you end up configuring it to listen on another port. Having done this myself, for some setups, I can speak from some experience (I also do a lot of work in the nginx package, which is where this experience comes from)
          – Thomas Ward
          Aug 2 '16 at 15:09















        up vote
        26
        down vote













        Andrew Chan provided the right answer for me. To extend his answer a bit, here's what you can do on the commandline;



        stop apache2



        sudo systemctl stop apache2.service



        prevent apache2 to start at boot



        sudo systemctl disable apache2.service



        Reinstall nginx



        sudo apt-get install nginx






        share|improve this answer



















        • 1




          I would suggest that you not disable Apache2 at boot if you need it - there are many cases where you do not need to disable Apache if you end up configuring it to listen on another port. Having done this myself, for some setups, I can speak from some experience (I also do a lot of work in the nginx package, which is where this experience comes from)
          – Thomas Ward
          Aug 2 '16 at 15:09













        up vote
        26
        down vote










        up vote
        26
        down vote









        Andrew Chan provided the right answer for me. To extend his answer a bit, here's what you can do on the commandline;



        stop apache2



        sudo systemctl stop apache2.service



        prevent apache2 to start at boot



        sudo systemctl disable apache2.service



        Reinstall nginx



        sudo apt-get install nginx






        share|improve this answer














        Andrew Chan provided the right answer for me. To extend his answer a bit, here's what you can do on the commandline;



        stop apache2



        sudo systemctl stop apache2.service



        prevent apache2 to start at boot



        sudo systemctl disable apache2.service



        Reinstall nginx



        sudo apt-get install nginx







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Aug 2 '16 at 15:07

























        answered Jul 31 '16 at 14:45









        A.R. Winters

        26134




        26134








        • 1




          I would suggest that you not disable Apache2 at boot if you need it - there are many cases where you do not need to disable Apache if you end up configuring it to listen on another port. Having done this myself, for some setups, I can speak from some experience (I also do a lot of work in the nginx package, which is where this experience comes from)
          – Thomas Ward
          Aug 2 '16 at 15:09














        • 1




          I would suggest that you not disable Apache2 at boot if you need it - there are many cases where you do not need to disable Apache if you end up configuring it to listen on another port. Having done this myself, for some setups, I can speak from some experience (I also do a lot of work in the nginx package, which is where this experience comes from)
          – Thomas Ward
          Aug 2 '16 at 15:09








        1




        1




        I would suggest that you not disable Apache2 at boot if you need it - there are many cases where you do not need to disable Apache if you end up configuring it to listen on another port. Having done this myself, for some setups, I can speak from some experience (I also do a lot of work in the nginx package, which is where this experience comes from)
        – Thomas Ward
        Aug 2 '16 at 15:09




        I would suggest that you not disable Apache2 at boot if you need it - there are many cases where you do not need to disable Apache if you end up configuring it to listen on another port. Having done this myself, for some setups, I can speak from some experience (I also do a lot of work in the nginx package, which is where this experience comes from)
        – Thomas Ward
        Aug 2 '16 at 15:09










        up vote
        7
        down vote













        I just had this issue, but the solution was slightly different.



        Once I solved a simple site misconfiguration, I was able to update nginx.



        Check your nginx error log:




        sudo cat /var/log/nginx/error.log|less




        Then try again:




        sudo apt-get update;sudo apt-get upgrade







        share|improve this answer





















        • logs FTW, in my case the 80 port was already in use which was the cause of error
          – xliiv
          Jun 30 '17 at 18:47















        up vote
        7
        down vote













        I just had this issue, but the solution was slightly different.



        Once I solved a simple site misconfiguration, I was able to update nginx.



        Check your nginx error log:




        sudo cat /var/log/nginx/error.log|less




        Then try again:




        sudo apt-get update;sudo apt-get upgrade







        share|improve this answer





















        • logs FTW, in my case the 80 port was already in use which was the cause of error
          – xliiv
          Jun 30 '17 at 18:47













        up vote
        7
        down vote










        up vote
        7
        down vote









        I just had this issue, but the solution was slightly different.



        Once I solved a simple site misconfiguration, I was able to update nginx.



        Check your nginx error log:




        sudo cat /var/log/nginx/error.log|less




        Then try again:




        sudo apt-get update;sudo apt-get upgrade







        share|improve this answer












        I just had this issue, but the solution was slightly different.



        Once I solved a simple site misconfiguration, I was able to update nginx.



        Check your nginx error log:




        sudo cat /var/log/nginx/error.log|less




        Then try again:




        sudo apt-get update;sudo apt-get upgrade








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 16 '17 at 4:30









        Taiger

        7111




        7111












        • logs FTW, in my case the 80 port was already in use which was the cause of error
          – xliiv
          Jun 30 '17 at 18:47


















        • logs FTW, in my case the 80 port was already in use which was the cause of error
          – xliiv
          Jun 30 '17 at 18:47
















        logs FTW, in my case the 80 port was already in use which was the cause of error
        – xliiv
        Jun 30 '17 at 18:47




        logs FTW, in my case the 80 port was already in use which was the cause of error
        – xliiv
        Jun 30 '17 at 18:47










        up vote
        5
        down vote













        In my case the error is the server has IPv6 disabled.
        Solution:



        Edit /etc/nginx/sites-enabled/default and comment IPv6 out:



        listen [::]:80 default_server;


        Reinstall nginx:



        apt purge nginx
        apt autoremove
        apt install nginx





        share|improve this answer























        • @DavidFoerster With apt 1.0, a new binary was introduced that collects many of the familiar (sub-)commands that were distributed among apt-get, apt-cache and so forth. For example, apt update equals apt-get update, apt search some-name equals apt-cache search some-name and so forth. In some cases, there has been some rewording, like apt full-upgrade that equals apt-get dist-upgrade. The old binaries and their commands are still available for those who fancy them, as well.
          – Henning Kockerbeck
          Oct 27 '16 at 15:04










        • @HenningKockerbeck: Thanks. I truly didn't know back then and thought it was a typo but I educated myself in the mean time.
          – David Foerster
          Oct 27 '16 at 17:51










        • Worked for me, but I can't implement this in my shell scripts for server deployment, that's ridiculously roundabout...
          – Menasheh
          Feb 15 '17 at 6:09















        up vote
        5
        down vote













        In my case the error is the server has IPv6 disabled.
        Solution:



        Edit /etc/nginx/sites-enabled/default and comment IPv6 out:



        listen [::]:80 default_server;


        Reinstall nginx:



        apt purge nginx
        apt autoremove
        apt install nginx





        share|improve this answer























        • @DavidFoerster With apt 1.0, a new binary was introduced that collects many of the familiar (sub-)commands that were distributed among apt-get, apt-cache and so forth. For example, apt update equals apt-get update, apt search some-name equals apt-cache search some-name and so forth. In some cases, there has been some rewording, like apt full-upgrade that equals apt-get dist-upgrade. The old binaries and their commands are still available for those who fancy them, as well.
          – Henning Kockerbeck
          Oct 27 '16 at 15:04










        • @HenningKockerbeck: Thanks. I truly didn't know back then and thought it was a typo but I educated myself in the mean time.
          – David Foerster
          Oct 27 '16 at 17:51










        • Worked for me, but I can't implement this in my shell scripts for server deployment, that's ridiculously roundabout...
          – Menasheh
          Feb 15 '17 at 6:09













        up vote
        5
        down vote










        up vote
        5
        down vote









        In my case the error is the server has IPv6 disabled.
        Solution:



        Edit /etc/nginx/sites-enabled/default and comment IPv6 out:



        listen [::]:80 default_server;


        Reinstall nginx:



        apt purge nginx
        apt autoremove
        apt install nginx





        share|improve this answer














        In my case the error is the server has IPv6 disabled.
        Solution:



        Edit /etc/nginx/sites-enabled/default and comment IPv6 out:



        listen [::]:80 default_server;


        Reinstall nginx:



        apt purge nginx
        apt autoremove
        apt install nginx






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jun 2 '16 at 9:51









        Videonauth

        23.4k126898




        23.4k126898










        answered Jun 2 '16 at 9:28









        user551419

        512




        512












        • @DavidFoerster With apt 1.0, a new binary was introduced that collects many of the familiar (sub-)commands that were distributed among apt-get, apt-cache and so forth. For example, apt update equals apt-get update, apt search some-name equals apt-cache search some-name and so forth. In some cases, there has been some rewording, like apt full-upgrade that equals apt-get dist-upgrade. The old binaries and their commands are still available for those who fancy them, as well.
          – Henning Kockerbeck
          Oct 27 '16 at 15:04










        • @HenningKockerbeck: Thanks. I truly didn't know back then and thought it was a typo but I educated myself in the mean time.
          – David Foerster
          Oct 27 '16 at 17:51










        • Worked for me, but I can't implement this in my shell scripts for server deployment, that's ridiculously roundabout...
          – Menasheh
          Feb 15 '17 at 6:09


















        • @DavidFoerster With apt 1.0, a new binary was introduced that collects many of the familiar (sub-)commands that were distributed among apt-get, apt-cache and so forth. For example, apt update equals apt-get update, apt search some-name equals apt-cache search some-name and so forth. In some cases, there has been some rewording, like apt full-upgrade that equals apt-get dist-upgrade. The old binaries and their commands are still available for those who fancy them, as well.
          – Henning Kockerbeck
          Oct 27 '16 at 15:04










        • @HenningKockerbeck: Thanks. I truly didn't know back then and thought it was a typo but I educated myself in the mean time.
          – David Foerster
          Oct 27 '16 at 17:51










        • Worked for me, but I can't implement this in my shell scripts for server deployment, that's ridiculously roundabout...
          – Menasheh
          Feb 15 '17 at 6:09
















        @DavidFoerster With apt 1.0, a new binary was introduced that collects many of the familiar (sub-)commands that were distributed among apt-get, apt-cache and so forth. For example, apt update equals apt-get update, apt search some-name equals apt-cache search some-name and so forth. In some cases, there has been some rewording, like apt full-upgrade that equals apt-get dist-upgrade. The old binaries and their commands are still available for those who fancy them, as well.
        – Henning Kockerbeck
        Oct 27 '16 at 15:04




        @DavidFoerster With apt 1.0, a new binary was introduced that collects many of the familiar (sub-)commands that were distributed among apt-get, apt-cache and so forth. For example, apt update equals apt-get update, apt search some-name equals apt-cache search some-name and so forth. In some cases, there has been some rewording, like apt full-upgrade that equals apt-get dist-upgrade. The old binaries and their commands are still available for those who fancy them, as well.
        – Henning Kockerbeck
        Oct 27 '16 at 15:04












        @HenningKockerbeck: Thanks. I truly didn't know back then and thought it was a typo but I educated myself in the mean time.
        – David Foerster
        Oct 27 '16 at 17:51




        @HenningKockerbeck: Thanks. I truly didn't know back then and thought it was a typo but I educated myself in the mean time.
        – David Foerster
        Oct 27 '16 at 17:51












        Worked for me, but I can't implement this in my shell scripts for server deployment, that's ridiculously roundabout...
        – Menasheh
        Feb 15 '17 at 6:09




        Worked for me, but I can't implement this in my shell scripts for server deployment, that's ridiculously roundabout...
        – Menasheh
        Feb 15 '17 at 6:09










        up vote
        1
        down vote













        When I checked /var/log/nginx/error.log I saw that the installer was unable to open /var/cache/nginx/microcache



        A directory listing showed there was no /var/cache/nginx directory, so I created it and the install succeeded.






        share|improve this answer

























          up vote
          1
          down vote













          When I checked /var/log/nginx/error.log I saw that the installer was unable to open /var/cache/nginx/microcache



          A directory listing showed there was no /var/cache/nginx directory, so I created it and the install succeeded.






          share|improve this answer























            up vote
            1
            down vote










            up vote
            1
            down vote









            When I checked /var/log/nginx/error.log I saw that the installer was unable to open /var/cache/nginx/microcache



            A directory listing showed there was no /var/cache/nginx directory, so I created it and the install succeeded.






            share|improve this answer












            When I checked /var/log/nginx/error.log I saw that the installer was unable to open /var/cache/nginx/microcache



            A directory listing showed there was no /var/cache/nginx directory, so I created it and the install succeeded.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Feb 4 '17 at 13:08









            Charles Oertel

            111




            111






















                up vote
                1
                down vote













                In my case it has been a misconfigurated file in /etc/nginx/sites-enabled/
                I named them as .old files, but that does not matter. They will be readed and may prevend an successfull installation or start of that service.
                Be careful with files in that folder and read your error output carefully as discribed by @Taiger






                share|improve this answer

























                  up vote
                  1
                  down vote













                  In my case it has been a misconfigurated file in /etc/nginx/sites-enabled/
                  I named them as .old files, but that does not matter. They will be readed and may prevend an successfull installation or start of that service.
                  Be careful with files in that folder and read your error output carefully as discribed by @Taiger






                  share|improve this answer























                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    In my case it has been a misconfigurated file in /etc/nginx/sites-enabled/
                    I named them as .old files, but that does not matter. They will be readed and may prevend an successfull installation or start of that service.
                    Be careful with files in that folder and read your error output carefully as discribed by @Taiger






                    share|improve this answer












                    In my case it has been a misconfigurated file in /etc/nginx/sites-enabled/
                    I named them as .old files, but that does not matter. They will be readed and may prevend an successfull installation or start of that service.
                    Be careful with files in that folder and read your error output carefully as discribed by @Taiger







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 20 at 20:22









                    Godot85

                    112




                    112






















                        up vote
                        0
                        down vote













                        Before the installation remove any manually added symlinks from /sites-enabled.






                        share|improve this answer



























                          up vote
                          0
                          down vote













                          Before the installation remove any manually added symlinks from /sites-enabled.






                          share|improve this answer

























                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote









                            Before the installation remove any manually added symlinks from /sites-enabled.






                            share|improve this answer














                            Before the installation remove any manually added symlinks from /sites-enabled.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Jun 14 at 14:08









                            David Foerster

                            27.4k1363108




                            27.4k1363108










                            answered Jun 14 at 11:19









                            Deto

                            1




                            1






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Ask Ubuntu!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f764222%2fnginx-installation-error-in-ubuntu-16-04%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                How to change which sound is reproduced for terminal bell?

                                Can I use Tabulator js library in my java Spring + Thymeleaf project?

                                Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents