This tutorial will work on other debian-based systems (like Ubuntu) too.


Generally, we try to run the latest version of nginx onĀ all of our servers. Sadly, the versions of nginx included in the Raspbian and Ubuntu repositories are quite old. Luckily for us, the nginx team have their own apt repository!

So, here we go.

Let’s first install the PGP signing key:

sudo curl | apt-key add -

Then add the repo to our apt sources:

sudo echo -e "deb `lsb_release -cs` nginxndeb-src `lsb_release -cs` nginx" > /etc/apt/sources.list.d/nginx.list

…and update our index:

sudo apt-get update

Then, if you’re installing nginx:

sudo apt-get install nginx

…or just upgrading it:

sudo apt-get dist-upgrade

And then you’re done!