How to install NGINX on your VPS (Ubuntu 18.04)
Welcome to Something!
In this guide, you will learn how to install NGINX to your powerful VPS
This guide was created for Ubuntu 18.04 but should work on another Ubuntu flavors.
Need help connecting to your VPS? Check out this tutorial!
- Detailed instructions
This tutorial aims to download NGINX, the popular web server and reverse proxy tool used by a lot of server world wide. To do that we need to execute 2 commands. If you need detailed instructions, follow the next part of this guide.
1. Installing NGINX
Note! Each line is a command that needs to run separately
$ sudo apt update sudo apt install nginx
2. Setting up our firewall (optional)
If you are using a firewall, such as ufw, you will need to make sure the firewall allows connections to Nginx from the outside world. Note, if you are not using ufw, consult your firewall manual.
NGINX has 3 different levels for the firewall:
Nginx Full: Allows both HTTPS (443) and HTTP (80) ports
Nginx HTTP: Only allows HTTP traffic (Port 80)
Nginx HTTPS: Only allows HTTPS traffic (Port 443)
To allow either of those options into our firewall, we need to run the following command sudo ufw allow <name>, for this tutorial we will allow Nginx Full so we will run
$ sudo ufw allow 'Nginx Full' $ sudo ufw reload
Make sure the firewall is running by executing sudo ufw enable
Let's validate our settings have been saved by running
$ sudo ufw status
Congratulations! You have installed NGINX to your VPS and allowed the firewall to connect. Test it out by visiting your VPS ip address on your browser!
Updated on: 03/03/2021