Install Nginx on Debian/ Ubuntu

Install Nginx on Debian/ Ubuntu

Category : How-to

Get Social!

nginx-logoInstalling Nginx on Debian or Ubuntu is as easy as a single apt-get command, however it does not install the latest version of Nginx. In fact, the latest stable Nginx version is 1.8 and the latest package in Debian’s standard repository is 1.2

To get the latest stable version we need to add a new source to our package manager. Before doing so, add the Nginx PGP key which is used to sign all packages. Run the below commands to download the key from, add it to our package manager and clean up the local downloaded file.

apt-key add nginx_signing.key
rm nginx_signing.key

We can now create the new source file with the Nginx repository location.

vi /etc/apt/sources.list.d/nginx.list

Add one of the following depending on your Linux distribution. You will need to change wheezy or trusty to the codename of your distribution version.


deb wheezy nginx
deb-src wheezy nginx


deb trusty nginx
deb-src trusty nginx


Finally, update your local repository cache and install Nginx.

apt-get update
apt-get install nginx

Run -v on nginx and you should see something like version 1.8.0.

nginx -v
nginx version: nginx/1.8.0




19-Jun-2015 at 4:09 pm

Hey James, small typo: should be:
vi /etc/apt/sources.list.d/nginx.list


    19-Jun-2015 at 5:14 pm

    Thanks for mentioning it – I’ve updated the post.

Leave a Reply

Visit our advertisers

Quick Poll

Do you use ZFS on Linux?

Visit our advertisers