Nginx – pronounced “Engine X” – is an open-source web server BSD license Software. It is widely used for load balancing, reverse proxy and caching features. It is based on the asynchronous architecture which made it the most popular and best-performing web servers.
- A dedicated server or a VPS (Virtual Private Server ) with Ubuntu 18.04.
- You should have root access of the server.
Step 1: Installing Nginx
The best way to install the Nginx on Ubuntu is to use the version included in Ubuntu’s default repository.
sudo apt update sudo apt install nginx
This command will first update your software packages and then install Nginx.
once you have installed it, the Nginx service should start automatically and will be enabled to start at boot time, you can check if it’s up and running.
sudo systemctl status nginx
Step 2 – Adjusting the Firewall
If you have firewall running on your system, then you will will have to open the port 80 (HTTP) and 433 (HTTPS) to listen the client requests.
Commands to enable the ports are as follows:-
sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw reload
Now, test your Nginx status is showing on your web browser, type your server ip address you will see the Nginx default web page.
Congrats you have sucessfully installed Nginx on your Ubuntu Server.