Update & Install Nginx Package
sudo apt update
sudo apt install nginx
The nginx packages will then be downloaded and installed.
The nginx install is complete. We just have to update the firewall rules to allow for HTTP.
Update UFW Rules
To update the Uncomplicated Firewall (UFW) you just need to execute these simple commands.
First, we will get a list of app entries for UFW.
Code language: PHP (php)
sudo ufw app list
sudo ufw allow 'Nginx HTTP'
sudo ufw status
The current status shows that UFW is not actually enabled. When it is enabled our rule will be included.
If you wish to enable UFW
sudo ufw enable
In this example and test, I left it disabled.
At this point, we should be able to test Nginx by pulling up the IP address or localhost if you have a GUI installed. You should see the standard Nginx confirmation screen.
The directory being served is located at /var/www/html . You can transfer files to this folder to update the default Nginx configuration.
You can review the default Nginx configuration file /etc/nginx/sites-available/default
sudo nano /etc/nginx/sites-available/default
Here is a reference to all the Nginx configuration options: