Steps to install specific version of nginx on Linux ubuntu

Steps to install specific version of nginx

Nginx is an open source HTTP Web server and reverse proxy server.
We should pronounced it as “Engine-Ex,”.
It is useful to re route application/service url for security purpose.

Environment : Linux ubuntu 16.04.x
Purpose: For Angular application we need to setup nginx for re routing urls for security purpose.
Sometime installed nginx is not compatible to ubuntu 16.04.x so need to install specific nginx version.

It is difficult to find nginx version name/id/version code on their side even i could not able to find on Google also.
Below is the trick to install specific nginx version.

1) Go to command line, run below command to downloads the package lists from the repositories and updates them to newest versions of packages and their dependencies.

sudo apt-get update

2) Here is trick to know nginx version names, run below command where we have added wrong version

sudo apt-get install nginx=1.10.3-0ubuntu0.16.04.3

You will get an unmet dependncy error

The following packages have unmet dependencies:
nginx : Depends: nginx-core (< 1.10.3-0ubuntu0.16.04.3.1~) but it is not going to be installed or
nginx-full (< 1.10.3-0ubuntu0.16.04.3.1~) but 1.14.2-0+xenial1 is to be installed or
nginx-light (< 1.10.3-0ubuntu0.16.04.3.1~) but it is not going to be installed or
nginx-extras (< 1.10.3-0ubuntu0.16.04.3.1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Above error will show you available nginx versions..pick required version.
3) Run below command to run nginx version common dependencies

sudo apt-get install nginx-common=1.10.3-0ubuntu0.16.04.3

4) Run below command to run nginx version core dependencies

sudo apt-get install nginx-core=1.10.3-0ubuntu0.16.04.3

5)

sudo apt-get install nginx=1.10.3-0ubuntu0.16.04.3

6) Below command to allow all required packages of nginx

sudo ufw allow 'Nginx Full'

 

Leave a Reply