Tutorial To Install Nginx On Ubuntu 20.04 LTS
Nginx is an open-source web server created by Igor Sysoev and first publicly released in 2004. It can also be used as a reverse proxy, load balancer, mail proxy, and HTTP cache.
Nginx is also considered as an alternative to Apache web server. In this post, we are going to show you the tutorial to install Nginx on Ubuntu 20.04 LTS.
Install Nginx On Ubuntu 20.04 LTS
Nginx is available in the Ubuntu repository by default. Run the following command to install Nginx on Ubuntu 20.04 LTS.
sudo apt update sudo apt install nginx
After the installation process is finished, run the following command to check the status of Nginx. Nginx starts automatically.
sudo systemctl status nginx
Meanwhile, you need to make sure that your firewall is configured to allow traffic on HTTP (80
) and HTTPS (443
) ports. Nginx registers itself as a service with ufw
.
Run the following command to list the application configurations that ufw
knows how to work with by typing:
sudo ufw app list
You should get a listing of the application profiles with the output like below:
Available applications:
Nginx Full
Nginx HTTP
Nginx HTTPS
OpenSSH
Nginx Full: Both port 80 and port 443 (TLS/SSL encrypted traffic) open.
Nginx HTTP: Only port 80 (normal, unencrypted web traffic) open.
Nginx HTTPS: Only port 443 (TLS/SSL encrypted traffic) open.
Run the following command to tell the firewall to allow the required traffic through specific ports.
sudo ufw allow 'Nginx Full'
To verify the status type:
sudo ufw status
Finally, you can open a browser and type http://ipaddress
in your browser to access Nginx. You should see the default Nginx landing page.