[Updated on Date: 2021-01-21] As an administrator of high-traffic websites, you need a high-performance web server. Nginx is an open-source and popular web server with global fame. Also, you can use it as a reverse proxy. In this article, you will learn How To Install Nginx on Ubuntu 20.04 LTS. In case you are not sure to purchase a Linux VPS, our perfect packages would be satisfying. Either you can buy your own Ubuntu VPS and continue learning this guide.
Table of Contents
Tutorial Install Nginx on Ubuntu 20.04 LTS
To let this tutorial work better, please consider the below Prerequisites:
A non-root user with sudo privileges.
To set up, follow our Initial server setup on Ubuntu 20.04.
Install Nginx on Ubuntu 20.04 | Ubuntu 18.04
Nginx has been released under the 2-clause BSD License and you can install to on your Ubuntu server in about 20 minutes. Nginx is available in Ubuntu’s default repositories. So, you can install the repositories by apt packaging system. Let’s go through the steps of this guide to learn and finish it.
Step 1: Install Nginx
First, you should update the local package with the below command:
sudo apt update
Then install Nginx with the command below:
sudo apt install nginx
Step 2: Adjusting the Firewall on ubuntu 20.04
First, you need to enable the UFW firewall. Then Check the available UFW firewall application profiles with the command below:
sudo ufw app list
Available applications: Nginx Full Nginx HTTP Nginx HTTPS OpenSSH
Now enable permitting traffic on port 80:
sudo ufw allow 'Nginx HTTP'
You should Verify the change:
sudo ufw status
Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere Nginx HTTP ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) Nginx HTTP (v6) ALLOW Anywhere (v6)
Step 3: Check Web Server
Check to see if the webserver is running:
systemctl status nginx
The output should be as follows:
nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset:> Active: active (running) since Mon 2020-05-07 21:35:26 UTC; 2min 20s ago Docs: man:nginx(8) Main PID: 13255 (nginx) Tasks: 2 (limit: 1137) Memory: 4.6M CGroup: /system.slice/nginx.service ├─13255 nginx: master process /usr/sbin/nginx -g daemon on; master> └─13256 nginx: worker process
Then you should check Access the default Nginx landing page in the browser with the command below:
After entering the IP address on the browser, you should see the default Nginx landing page:
In this article, you learned How To Install Nginx on Ubuntu 20.04. From now on, you can configure PHP, Python, Perl, and Ruby apps or install TLS, SSL certificates to secure traffic. In case you are interested in reading more, find our related article on How to install Nginx on Debian 10.