Here is how to install Nginx on Ubuntu 20.04 in under two minutes:
Step 1 - Update the package list on your system
The first step is to update the package list on your system before proceeding to actual installation:
sudo apt update -y
apt update downloads the package lists from the repositories and updates
them to get information on the newest versions of packages and their
dependencies. It will do this for all repositories and PPAs.
Step 2 - Install Nginx
nginx package using the apt install command:
sudo apt install nginx
Step 3 - Adjust the firewall
We are not done quite yet. Now you need to adjust the firewall to allow web traffic.
sudo ufw allow 'Nginx HTTP'
Now, everything is installed and ready to go.
To test if the service is running, execute the following command:
systemctl status nginx
To stop the service, execute this command:
sudo systemctl stop nginx
To start the service, execute this command
sudo systemctl start nginx
You successfully installed Nginx on your system. You can go ahead and type your server's IP into the browser to see the default Nginx page (if the server is running).
We call you when your
website goes down
Get notified with a radically better
infrastructure monitoring platform.