How to Check & Install Specific Nginx version on Ubuntu Linux

This post shows students and new users steps to find out the version of Nginx running on their system or install a specific Nginx version on Ubuntu Linux. For users who want to know what version of Nginx is running on their server, the steps below will show them how.

For those who also want to know how to install a specific version on Nginx on Ubuntu Linux, the steps below will also show them how to do that. The steps will also include options to find out what modules are loaded with Nginx on Ubuntu Linux as well.

For those who don’t know Nginx is, here’s an overview:

Nginx is one of the most popular open source web server in the world. Chances are many of the websites you visit today mostly likely are running Nginx HTTP server. And if you’re thinking of running a website, you find yourself using Nginx web server as well.

To get started with find out what version of Nginx you’re running, or installing a specific Nginx version on Ubuntu Linux, continue below.

How to find out what version of Nginx you are running in Ubuntu Linux

Installing Nginx on Ubuntu Linux is easy. Simply run the apt-get install nginx commands to get it installed.

On Ubuntu Linux command console, run the commands below to check Nginx version.

nginx -v
# OR
nginx -V

Once you run the command above, it should output similar lines as below:

nginx version: nginx/1.18.0 (Ubuntu)

As you can see, the version number 1.18.0 is the latest version currently available in Ubuntu repository, however, it doesn’t mean that it is the latest version of Nginx available to be installed.

You may also be able to find more info of the Nginx version installed by running the commands below:

apt info nginx

When you run the commands above, it should list similar lines as below:

Package: nginx
Version: 1.18.0-0ubuntu1.2
Priority: optional
Section: web
Origin: Ubuntu
Maintainer: Ubuntu Developers <>
Original-Maintainer: Debian Nginx Maintainers <>

If you have curl installed, you may also be able to tell what version of Nginx running on Ubuntu Linux by using the commands below:

curl -I http://localhost/

When run the commands above, it should list something similar to the lines below:

HTTP/1.1 200 OK
Server: nginx/1.18.0 (Ubuntu)
Date: Tue, 28 Dec 2021 04:34:49 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Tue, 28 Dec 2021 04:32:13 GMT
Connection: keep-alive
ETag: "61ca934d-264"
Accept-Ranges: bytes

How to find out what Nginx modules are currently loaded in Ubuntu Linux

Now that you know how to find out what version of Nginx installed on your system, the commands below show you how to list all the modules that are currently loaded with Nginx.

nginx -V

Once you run the commands above, it should output similar lines as below.

nginx version: nginx/1.18.0 (Ubuntu)
built with OpenSSL 1.1.1f  31 Mar 2020
TLS SNI support enabled


Depending on your environment, the list above may be longer or shorted.

How to install specific version of Nginx on Ubuntu Linux

By default, Ubuntu repository contains the latest stable version of Nginx. When you install Nginx from Ubuntu repository, it will only install that specific version available at that time.

If you need to install a specific version not available in Ubuntu Linux, you may have to add a third party repository to your system.

Run the commands below to add a repository to Ubuntu Linux that will allow you to install specific versions.

First, install the necessary commands below:

sudo apt update
sudo apt install software-properties-common

Next, run the commands below to add the repository.

sudo add-apt-repository ppa:ondrej/nginx
sudo apt-get update

After that, you can search for and install specific version of Nginx.

apt-cache showpkg nginx

Install a specific version by running the command format below:

sudo apt-get install nginx-light=<complete version name>

Replace <complete version number> with the version number available for Ubuntu.


sudo apt install

Now the new version should reflect as shown below:

nginx version: nginx/1.20.1

That should do it!


This post showed you how to check and install specific Ngnix version on Ubuntu Linux. If you find any error above or have something to add, please use the comment form below.

1 Comment

Leave a Comment

Your email address will not be published.