Here are the steps to install nginx, you must ensure that the environment is available as follows:
First, you need to update the system, run the following command
sudo apt update && sudo apt upgrade -y
Next, we will run the following command to install nginx
sudo apt install nginx -y
After successful installation, we will check the nginx system with the following command
sudo systemctl status nginx
If successful, we will see the result as follows
# ● nginx.service - A high performance web server and a reverse proxy server
# Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
# Active: active (running)
If the status of nginx is running, this is a sign that everything is working normally. Otherwise, you need to execute the following command to start nginx
sudo systemctl start nginx
Finally, to confirm that everything is working, access the server/virtual machine through a browser and we will see the Welcome interface of nginx as shown below
If you see the interface, congratulations, nginx is running on the server/VM.