Install latest version of Nginx on Ubuntu

NginxI always run the latest LTS version of Ubuntu on all my servers. Unfortunately, the Nginx versions tend to be quite the bit behind the current release. So how do you get an updated, current version of without resorting to having to maintain the packages yourself? Luckily, the Nginx team have their own Ubuntu apt repository so it’s easy to keep current with the latest version of Nginx.

In general, you should deploy the NGINX mainline branch at all times.  You may wish to use stable if you are concerned about possible impacts of new features, such as incompatibility with third-party modules or the introduction of bugs in new features.

Source: NGINX 1.6 and 1.7 released – Which version should I use?

First, to avoid missing PGP key during installation and upgrades, install the Nginx team’s package signing key:

Add the repo to your apt sources:

Resynchronize the package index files from their sources:

If you are installing nginx:

… or if you are upgrading:

And you’re done :-)

Maybe you are also looking for how to install the latest version of PHP?
… or even replace PHP with HHVM.

There are 12 comments

I love comments that bring new insights, shares ideas and experiences, and most of all: corrects my mistakes. For support questions, there are other fora, like Stack Overflow, Server Fault and the WordPress support forum.

Your email address will not be published. Required fields are marked *