How to install Nginx on Ubuntu 23.04

It is one of the most popular open-source and lightweight web servers. Let us see the minimal steps to install, validate, and manage your Nginx installation.
This post tries to capture the steps that we need to install and set up Nginx on our machine running Ubuntu 23.04. The same set of steps can be used to install node.js on most of the recent versions of Ubuntu.
Prerequisites:
Steps to install, validate and manage Nginx
Nginx (pronounced “engine-X”) is one of the most popular open source and lightweight webserver that excels at load balancing, caching and working as a reverse proxy. It's event driven and was developed keeping scalability and performance issues of other web servers in mind.
Installing Nginx:
Update the apt package index
sudo apt update
Install Nginx from the package manager
sudo apt install nginx
Check the status of the web server
sudo systemctl status nginx
Adjust the firewall:
Verify the status of UFW (Uncomplicated Firewall)
sudo ufw status
Only if the above status returns as inactive
sudo ufw enable
List the app configurations that UFW knows
sudo ufw app list
Open port 80 and 443 needed by Nginx
sudo ufw allow 'Nginx Full'
Verify the status (now should have SSH and Nginx)
sudo ufw status
Verify the nginx and firewall changes:
Visit the public ip of your server and you should see the default welcome page by Nginx.
Managing Nginx:
Check the status of nginx service
sudo systemctl status nginx
Stop nginx service
sudo systemctl stop nginx
Start nginx service
sudo systemctl start nginx
Prevent automatic start of nginx when server boots up
sudo systemctl disable nginx
Allow the service to start up at boot
sudo systemctl enable nginx
Stop and start at one go
sudo systemctl restart nginx
Reload config files when we amend them
sudo systemctl reload nginx
Validate syntax errors in nginx server files
sudo nginx -t