How to Install the latest version of Nginx on Debian and Ubuntu. As you know that if you perform the installation of nginx (engine x) directly through the command apt-get install nginx, then good on Debian or Ubuntu, web server nginx is a web server installed nginx version of old did not update. If you use Ubuntu 6, then nginx version installed is version 1.4.6, whereas currently the newest version is releasing the nginx, nginx version 1.9.3.

For those of you who have already done the installation of nginx and want to find out the version of nginx installed on your Ubuntu or Debian server, please give the command:
# nginx -v
Initial preparation before Installing the new version of Nginx:
- To be able to install the latest version of nginx, you must ensure that no other application that is using port 80 on the server your Ubuntu or Debian. Please note that it is usually already installed applications OpenVZ VPS web server apache by default, you can remove or change the port that apache before installing nginx. Please read the article how to change the port apache on debian and ubuntu for more information.
- When it turns on your Ubuntu or Debian server already installed the web server nginx version does not update (traditional), please follow these steps:
# apt-get purge nginx
# apt-get autoremove
Make sure you know the code name of Ubuntu or Debian version you are using. For example Debian Jessie for Debian, Ubuntu 8 Trusty for Ubuntu 6. Here I include table name code for some versions of Debian and Ubuntu are the most widely used at the moment:
After you meet the initial preparations above, please go to the stages of the process of installing the latest version of nginx:
Download the PGP key with wget through command:
# wget http://nginx.org/keys/nginx_signing.key
Make sure your server is already install wget, otherwise please install first with the command:
# apt-get install wget
Add a PGP key to your apt keyring with the program:
# sudo apt-key add nginx_signing.key
For Ubuntu users, please open the file/etc/apt/sources.list with using the usual file editor you use, I always use the nano editor:
# nano /etc/apt/sources.list
Add the following 2 lines into the file:
deb http://nginx.org/packages/ubuntu/ namecode nginx
deb-src http://nginx.org/packages/ubuntu/ namecode nginx
Replace designer with the code name Ubuntu version you are using. For example, I use Ubuntu 6.
Save the results of the edit that file with CTRL + X, Y.
For Debian users, please open the file/etc/apt/sources.list as well:
# nano /etc/apt/sources.list
Add the following 2 lines into the file:
deb http://nginx.org/packages/debian/ namecode nginx
deb-src http://nginx.org/packages/debian/ namecode nginx
Make sure you replace the designer by the name of the Debian version of the code that you use as well as on Ubuntu. Be sure to save the results of the edit that file with CTRL + X, Y.
Update Debian or Ubuntu through command:
# apt-get update
Install nginx as usual via the command:
# apt-get install nginx
Please wait until installation process is finished ngix. At the end of the installation will usually be listed versions of successful nginx installed on your Debian or Ubuntu server. The version is the version most updates from the web server nginx. If you need an extra application to create a dynamic website, you can install the MySQL database and PHP programming language.