Introduction
Nginx is one of the most popular lightweight web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet. It can be used as either a web server or reverse proxy.
In this guide, we’ll discuss how to install Nginx on your Ubuntu 20.04 server, adjust the firewall, manage the Nginx process, and set up server blocks for hosting more than one domain from a single server.
In this guide, we’ll discuss how to Update your package index and install Nginx on your Ubuntu 20.04 server:
sudo apt update
sudo apt install nginx
To start the web server when it is stopped
sudo systemctl start nginx
To stop your web server
sudo systemctl stop nginx
To stop and then start the service again
sudo systemctl restart nginx
Nginx can be reload without dropping connections.
sudo systemctl reload nginx
By default, Nginx is configured to start automatically when the server boots. you can disable:
sudo systemctl disable nginx
To re-enable the service to start up at boot, you can type:
sudo systemctl enable nginx