NGINX Installation on Ubuntu 18.04 LTS

NGINX (pronounced “Engine X“) is an open source Lightweight and High Performance Web Server, Reverse Proxy Server, HTTP Cache and Load Balancer. In this post, we will see the installation steps of NGINX Web Server.

Also Read: Ubuntu 18.04 LTS “Long Term Support” (Bionic Beaver) Server Installation Guide
Also Read: How to install Ubuntu 20.04 LTS Desktop
NGINX Open Source is available in two versions:
Mainline – Includes the latest features and bug fixes, it is reliable but may include some experimental module and new bugs.
Stable – This doesn’t include the latest features, has critical bug fixes that are always backported to the mainline version.

There are two ways to install NGINX Open Source:

Prebuilt binary package – Installing NGINX Open Source from a Pre-built package is quick and easy than building from source. This include almost all official Nginx modules and available for popular Operating System.
Compiling and Installing from Source – This is more flexible and can add particular modules, or apply the latest security patches.
Some NGINX Features:

  1. Handle hundreds of thousands of clients simultaneously
  2. Support TLS 1.3
  3. Reverse proxy with caching
  4. Load Balancing
  5. WebSockets
  6. Handling of static files, index files and auto-indexing
  7. Event-driven, asynchronous and non-blocking approach, doesn’t create new processes for each web request
  8. And Lot More….

In this post, we will install NGINX Open Source with Prebuilt binary package.

Prerequisite:
  1. Internet Access to download NGINX Open Source packages and to update latest Ubuntu packages.
  2. root or sudo access
  3. Running instance of Ubuntu 18.04 LTS Server

Installing a Prebuilt Ubuntu Package from an Ubuntu Repository

Step-1: Note down IP Address of the system
$ ip addr show | grep -i inet
Step-2Update Ubuntu Repository
$ sudo apt-get update $$ sudo apt upgrade
Step-3: Install the NGINX Package
$ sudo apt-get install nginx
Step-4: Verify the version of nginx post installation
$ sudo nginx -v
Step-5: Check the status of Nginx service. Following commands to start|stop|restart|reload nginx service on Ubuntu Linux.
$ sudo systemctl status nginx
$ sudo systemctl restart nginx
$ sudo systemctl start nginx
$ sudo systemctl stop nginx
$ sudo systemctl reload nginx

Step-6: Open Service Port of Nginx in System Firewall
Use the following command to open nginx service port no. 80 on system firewall (UFW) if the firewall is enable.

$ sudo ufw allow 80/tcp
$ sudo ufw allow 443/tcp
$ sudo ufw status

 

Step-7: NGINX default port is 80 check & verify listening on default port on Ubuntu Linux with ss and netstat command.
Also Read: Essential Linux Commands For Network Configuration and Troubleshooting for Every System Administrator Should Know
$ netstat  -nat | grep 80
$ ss  -nat  | grep 80

Step-8: Verify Working of NGINX Web Server

Open Web Browser (Chrome, Firefox etc.) and type IP address of the system (Refer Step-1: to get IP address of your system) and  press enter. Below default NGINX page indicates that NGINX server is running. 

Conclusion: In this tutorial, we have seen simple and easy steps to install NGINX Open Source on Ubuntu 18.04 LTS. Big thanks for reading all the way to the end. Please share it with Your Friends & Help Someone… and also Like Our Facebook Page. Let me hear your thoughts in the comments below!

Leave a Comment