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
.