How to install Nginx on Debian 11


Install Nginx

Nginxis a free, open-source webserver that provides HTTP, reverse proxy, caching, and load-balancing functionality. It’s a great alternative to Apache, and it’s easy to set up.

Install below packages.

sudo apt update
sudo apt install -y curl gnupg2 ca-certificates lsb-release

Download the Nginx repository signing key and add it to the system.

curl -fsSL http://nginx.org/keys/nginx_signing.key | sudo gpg --dearmor -o /usr/share/keyrings/nginx-keyring.gpg

Add Nginx repository to the system.

echo "deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] http://nginx.org/packages/debian `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list

Install Nginx package using the following command.

sudo apt update
sudo apt install -y nginx

Start the Nginx service after the installation.

sudo systemctl start nginx

Open a web browser and visit the below URL. http://your-ip-add-ress

 

You will get the welcome page that confirms that Nginx has been successfully installed and is up and running.

Nginx’s default document root in Debian 11 is /usr/share/nginx/html/. The configuration files are found under /etc/nginx/ directory.

LIFETIME.SOLUTIONS - LIFETIME.SOLUTIONS -