How to Upgrade Nginx on ubuntu server

By | September 3, 2014

Introduction:

Nginx is one of the most popular web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet. It is more resource-friendly than Apache in most cases and can be used as a web server or a reverse proxy.

Remember the best way to learn any new technical skill, is to play around and see how things work. Get comfortable you’re few steps in right direction. Click HERE to Order Your VPS NOW! so that you can gain the practical experience needed.

Now 50% OFF! VPS hosting solutions optimized for you: Click HERE to Order NOW!

Upgrading Nginx on ubuntu server 14.04

In this guide, i’ll walk you through how to upgrade Nginx installed on your Ubuntu server. Before you begin you need to make sure that you have root access privileges.

Step One — Upgrade Nginx

Check the version of nginx currently running on Server. You do so by running the following command line syntax:

root@gs2:/home/sibanda# nginx -v
nginx version: nginx/1.6.0

Step Two – Backup Nginx Configuration

Backup the configuration files :

root@gs2:/home/sibanda# cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.upgradeback_24082015

Step Three – Adding Nginx Repository

To add the Stable version of nginx apt repository, edit a file named /etc/apt/sources.list, and paste The following releases of Ubuntu nginx to your system’s Software Sources below.

root@gs2:/home/sibanda# vi /etc/apt/sources.list
deb http://ppa.launchpad.net/nginx/stable/ubuntu trusty main

Step Four – Stop Nginx Service

The nginx web server service can be stopped using the following command line syntax:

root@gs2:/home/sibanda# service nginx stop

Step Five – Nginx Upgrade

Now the actual upgrade to the Stable version of nginx begins, use the following command line syntax:

root@gs2:/home/sibanda# apt-get update && aptitude dist-upgrade -y && apt-get autoremove -y

The following packages will be upgraded:

nginx nginx-common nginx-full

3 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 421 kB of archives. After unpacking 111 kB will be freed.
WARNING: untrusted versions of the following packages will installed!

Untrusted packages could compromise your system’s security.
You should only proceed with the installation if you are certain that this is what you want to do.

nginx nginx-common nginx-full

Do you want to ignore this warning and proceed anyway?
To continue, enter “Yes” ; to abort, enter “No”: Yes

Step Seven – Start Nginx Web Server

The nginx web server can be started using the following command line syntax:

root@gs2:/home/sibanda#service nginx start

Step Eight – Check the Nginx Version

You can type the -v option to display nginx web server version. The syntax is:

root@gs2:/home/sibanda# nginx -v
nginx version: nginx/1.8.0

That’s it. Now you have the latest version of Nginx running on your server.