How to Install Nginx Web server on Ubuntu 14.04 Trusty

1

You might have heard of Nginx pronounced  as “engine-x” it is a web server just like apache (which is popular in shared hosting environments and the most popular web server in the world.)  and others.

nginx

Ever since I moved away from shared hosting environment my host all my blogs on a vps server I have been using nginx of different versions and today I will show you how to install nginx on your Ubuntu server.

Nginx is a bit better than apache in so many areas but configuration of virtual host is not that easy for newbies but don’t worry there are lots of tutorials available online.

First of all you have to update some programs and applications on your server, use the following commands.

apt-get update && apt-get upgrade -y

Installing Nginx:

  1. You can install nginx from your Ubuntu server which is added to repository using the following command on terminal or putty if you are using windows like me.
apt-get install nginx
  1. The following command will install the stable version available for Ubuntu server, I am using 14.4 as an example.
add-apt-repository ppa:nginx/stable
apt-get update && apt-get install nginx
  1. The following command will install the mainline version also known the development version of nginx, according to nginx team;

We recommend that in general you deploy the NGINX mainline branch at all times.

and then this;

Note that stable does not mean more reliable or more bug-free. In fact, the mainline is generally regarded as more reliable because we port all bug fixes to it, and not just critical fixes as for the stable branch. On the other hand, changes in the stable branch are very unlikely to affect third-party modules. We don’t make the same commitment concerning the mainline, where new features can affect the operation of third-party modules.

So let’s go ahead and install the mainline version of nginx on our Ubuntu server.

add-apt-repository ppa:nginx/development
apt-get update
apt-get install nginx

Installation process may have conflicts with your configuration files. If that’s the case, you will be prompted for an action. I would recommend that you hit D to see a diff off the changes and to back that up in a file for later use. Then proceed with N (the default) to keep your version.

I hope you find this guide useful.