1

On debian Jessie, I installed nginx via apt-get. Now I want to upgrade to the latest nginx to take advantage of http2. I was unable to add it to the source.list file because it's a Raspberry PI. I downloaded, compiled it no problem, but it installed it in a different location.

Now when I nginx -v I get 1.6.3, but if I /usr/local/sbin/nginx -v I get 1.11.2.

I can set the install path during config, bit I don't know of that's what I want to do. I would like to install 1.11 over top of 1.6 and not lose all of my site files and config. How do I upgrade nginx from source and keep all my old config?

gxx
  • 5,483
  • 2
  • 21
  • 42
alanj
  • 113
  • 5

1 Answers1

1

In my opinion a better route, instead of compiling on your own, especially if you aren't that experienced yet (no offense), would be to use backports, which exist, because:

You are running Debian stable, because you prefer the Debian stable tree. It runs great, there is just one problem: the software is a little bit outdated compared to other distributions. This is where backports come in.

Going this way would also provide you with security updates, which you otherwise would have taken care of yourself.

One caveat left: The current version of nginx in j-bpo is built against openssl 1.0.1, which means, you won't be able to use ALPN, but instead NPN, thus you couldn't serve HTTP/2 to Chrome users, because the devs dropped NPN support recently, but it will work for people using Firefox, for example. I've described a workaround over here. If it's possible for your two wait something like four more weeks: nginx in j-bpo will be rebuilt against openssl 1.0.2, so you don't need this workaround then anymore.

So, lets get this going (for now):

  • Add jessie-backports to your sources.list. It's described over here.

  • Set up APT pinning, to only pull packages you're specifying from jessie-backports:

    Put something along the lines of:

    Package: *
    Pin: release n=jessie
    Pin-Priority: 900
    
    Package: * 
    Pin: release a=jessie-backports
    Pin-Priority: 100
    

    into /etc/apt/preferences. If this file doesn't exist yet, create it.

  • Run apt-get update.

  • Run apt-get install -t jessie-backports nginx to install nginx from jessie-backports.

gxx
  • 5,483
  • 2
  • 21
  • 42
  • I can wait 4 weeks. Is there a schedule somewhere or something? – alanj Jul 13 '16 at 13:31
  • @alanj Well, as I wrote: If `HTTP/2` for `Chrome` users matters to you, you could use the workaround I've linked to **just now**. If `Chrome` people don't matter to you, then just use this answer. Regarding the schedule: It's not written down somewhere, so I can't link to. – gxx Jul 13 '16 at 13:33
  • how do you know it will be rebuilt against `openssl 1.0.2` in 4 weeks is what I was asking in that comment. Where did you get that information? Thanks for the great answer too! Very informative. – alanj Jul 13 '16 at 14:07
  • @alanj Private mails, to which I can't link to. What I wanted to say: You can serve `HTTP/2` by now, you don't have to wait four weeks. Either via the answer I've provided here, or via the workaround I've linked to. – gxx Jul 13 '16 at 14:07
  • @alanj `nginx` in `jessie-backports` was has now been build against `openssl 1.0.2` to support `ALPN`. – gxx Aug 05 '16 at 09:22