We may not have the course you’re looking for. If you enquire or give us a call on 01344203999 and speak to our training experts, we may still be able to help with your training requirements.
We ensure quality, budget-alignment, and timely delivery by our expert instructors.

This blog on “How to Install NGINX on Ubuntu 20.04 “discusses about NGINX, a high-performance web server that can also act as a reverse proxy, load balancer, and HTTP cache. It is widely used by many websites, such as Netflix, Hulu, and GitHub. If you want to host your own website or web application on Ubuntu 20.04, NGINX is a great choice. In this blog, you will learn How to Install NGINX On Ubuntu 20.04 and also learn how to create server blocks, set up firewall, and manage the NGINX process.
Table of Contents
1) What is NGINX?
2) Steps to Install and Configure Nginx on Ubuntu 20.04
a) Step 1: Installation of Nginx
b) Step 2: Firewall Configuration
c) Step 3: Verification of Your Web Server
d) Step 4: Administration of the Nginx Process
e) Step 5: Configuration of Server Blocks (Recommended)
f) Step 6: Acquainting Yourself with Crucial Nginx Files & Directories
3) Conclusion
What is NGINX?
NGINX is an open-source web server that was created in 2004 by Igor Sysoev, a Russian software engineer. He designed NGINX to handle high concurrency and low memory usage, making it an ideal choice for serving static and dynamic content. However, if you are considering Nginx Alternatives, you may want to explore options like Apache or LiteSpeed, depending on your specific needs.
NGINX also supports many features, such as SSL/TLS encryption, HTTP/2, gzip compression, caching, proxying, and load balancing. NGINX is one of the most popular web servers in the world, powering over 40% of the top 10,000 websites. Installing Docker on Ubuntu makes it easier to deploy NGINX in a containerized environment, simplifying setup and management.
Steps to Install and Configure Nginx on Ubuntu 20.04
To install and configure NGINX on Ubuntu 20.04, you will need to perform the following steps:

Step 1: Installation of Nginx
(100 words) The easiest way to install NGINX on Ubuntu 20.04 is to use the official Ubuntu repositories. To do this, you will need to update your system’s package index and then install the nginx package. You can do this by running the following commands in your terminal:
|
sudo apt update sudo apt install nginx |
This will install the latest stable version of NGINX on your system. You can verify the installation by checking the NGINX version with the command:
|
nginx -v |
You should see something like this:
|
nginx version: nginx/1.18.0 (Ubuntu) |
Step 2: Firewall Configuration
Before you can access your web server from the internet, you will need to configure your firewall to allow incoming HTTP and HTTPS traffic. Ubuntu 20.04 comes with a firewall called UFW (Uncomplicated Firewall), which is easy to use and manage. To enable UFW, you can run the command:
|
sudo ufw enable |
To allow HTTP and HTTPS traffic, you can run the commands:
|
sudo ufw allow 'Nginx HTTP' sudo ufw allow 'Nginx HTTPS' |
You can check the status of your firewall with the command:
|
sudo ufw status |
You should see something like this:
|
Status: active |
Empower your IT support team with NGINX Training for optimised web server performance and enhanced solutions!
Step 3: Verification of Your Web Server
(100 words) Now that you have installed and configured NGINX on your system, you can verify that your web server is working properly. To do this, you can open your web browser and type your server’s IP address or domain name in the address bar. You should see the default NGINX welcome page, which looks something like this:
|
!NGINX Welcome Page |
If you see this page, congratulations! You have successfully installed and configured NGINX on Ubuntu 20.04. If you don’t see this page, you may need to check your firewall settings, your network configuration, or your DNS records.
Expand your learning curve by signing up for our IT Support and Solution Training now!
Step 4: Administration of the Nginx Process
To manage the NGINX process on your system, you can use the systemctl command, which is a tool for controlling systemd services. systemd is the system and service manager for Linux, which handles the initialisation and management of processes. With the systemctl command, you can start, stop, restart, reload, enable, disable, and check the status of the NGINX service. Here are some examples of how to use the systemctl command with NGINX:
To start the NGINX service, you can run the command:
|
sudo systemctl start nginx |
To stop the NGINX service, you can run the command:
|
sudo systemctl stop nginx |
To restart the NGINX service, you can run the command:
|
sudo systemctl restart nginx |
To reload the NGINX service, you can run the command:
|
sudo systemctl reload nginx |
Reloading the service is useful when you make changes to the NGINX configuration files, as it will apply the changes without interrupting the existing connections.
To enable the NGINX service to start automatically on boot, you can run the command:
|
sudo systemctl enable nginx |
To disable the NGINX service from starting automatically on boot, you can run the command:
|
sudo systemctl disable nginx |
To check the status of the NGINX service, you can run the command:
|
sudo systemctl status nginx |
You should see something like this:
|
● nginx.service - A high performance web server and a reverse proxy server |
Step 5: Configuration of Server Blocks (Recommended)
Server blocks are a feature of NGINX that allow you to host multiple domains or websites on a single server. Each server block defines the configuration for a specific domain or website, such as the document root, the server name, the SSL certificates, the error pages, and the location blocks. Location blocks are used to define how NGINX should handle requests for different URIs within a server block.
For example, if your domain is example.com, you can create a file called example.com. In this file, you will write the configuration for your server block, following the NGINX syntax rules. Here is an example of a basic server block for example.com:
|
server { |
This server block tells NGINX to listen on port 80 for both IPv4 and IPv6, to use /var/www/example.com/html as the document root, to look for index files in the document root, to accept requests for example.com and www.example.com, and to serve the requested files or return a 404 error if not found.
Create, deploy and manage your server by signing up for our Introduction to Networking Training now!
Step 6: Acquainting Yourself with Crucial Nginx Files & Directories
NGINX has a modular and hierarchical configuration structure, which means that it consists of multiple files and directories that are included or referenced by each other. Understanding the purpose and location of these files and directories is crucial, especially when preparing for Nginx interview questions, as they will help you customize and optimize your web server effectively. Here are some of the most important NGINX files and directories on Ubuntu 20.04:
/etc/nginx: This is the main directory that contains all the configuration files and directories for NGINX.
/etc/nginx/nginx.conf: This is the main configuration file for NGINX, which defines the global settings and parameters for the web server. It also includes other configuration files from the /etc/nginx/conf.d and /etc/nginx/sites-enabled directories.
/etc/nginx/conf.d: This directory contains additional configuration files that are included by the /etc/nginx/nginx.conf file. You can use this directory to store configuration files for specific modules or features, such as SSL, gzip, or caching.
/etc/nginx/sites-available: This directory contains the configuration files for the server blocks, which define the settings for each domain or website that you host on your server. You can create as many server blocks as you need in this directory, but they will not be active until you enable them by creating a symbolic link to the /etc/nginx/sites-enabled directory.
/etc/nginx/sites-enabled: This directory contains the symbolic links to the configuration files for the server blocks that are active on your server. You can enable or disable a server block by creating or removing a symbolic link to the /etc/nginx/sites-available directory.
Conclusion
In this blog, you have learned How to Install NGINX on Ubuntu 20.04. You have also learned how to set up firewall, verify your web server, manage the NGINX process, and create server blocks for multiple domains. Additionally, if you're preparing for technical roles, exploring common NGINX Interview Questions can provide valuable insights. You have also acquainted yourself with the crucial NGINX files and directories.
Master the art of data processing by signing up for our IT Fundamental Training now!
Frequently Asked Questions
Which is the recommended way to install nginx in Ubuntu?
The recommended way to install NGINX in Ubuntu is to use the official Ubuntu repositories, as they provide the latest stable version of NGINX and the security updates. You can also install NGINX from the official NGINX repositories, which may offer newer features and modules, but they may not be compatible with the Ubuntu system.
Where is nginx stored in Ubuntu?
NGINX is stored in various locations in Ubuntu, depending on the type of files. The configuration files are stored in the /etc/nginx directory, the web root files are stored in the /var/www directory, and the log files are stored in the /var/log/nginx directory.
What are the other resources and offers provided by The Knowledge Academy?
The Knowledge Academy takes global learning to new heights, offering over 3,000+ online courses across 490+ locations in 190+ countries. This expansive reach ensures accessibility and convenience for learners worldwide.
Alongside our diverse Online Course Catalogue, encompassing 19 major categories, we go the extra mile by providing a plethora of free educational Online Resources like Blogs, eBooks, Interview Questions and Videos. Tailoring learning experiences further, professionals can unlock greater value through a wide range of special discounts, seasonal deals, and Exclusive Offers.
What is Knowledge Pass, and how does it work?
The Knowledge Academy’s Knowledge Pass, a prepaid voucher, adds another layer of flexibility, allowing course bookings over a 12-month period. Join us on a journey where education knows no bounds.
What are related IT Support and Solution Courses and blogs provided by The Knowledge Academy?
The Knowledge Academy offers various IT Support and Solution Courses, including NGINX Training. These courses cater to different skill levels, providing comprehensive insights into DNS Security.
Our IT Infrastructure & Networking blogs cover a range of topics related to NGINX Training, offering valuable resources, best practices, and industry insights. Whether you are a beginner or looking to advance your IT Support and Solution skills, The Knowledge Academy's diverse courses and informative blogs have you covered.
John Davies is a cybersecurity expert specialising in governance, risk management, and compliance. With over 15 years in the field, he has led enterprise-wide security programmes across finance, healthcare and public sector organisations. His content provides practical guidance on building secure environments, managing risk and aligning with regulatory frameworks.
Upcoming IT Infrastructure & Networking Resources Batches & Dates
Date
Fri 29th May 2026
Fri 25th Sep 2026
Fri 4th Dec 2026
Top Rated Course