How to install nginx on debian 11

NGINX is a free, open-source web server that is well-known for its high performance, stability, and low resource consumption. It can be used to serve static and dynamic content, reverse proxy, load balance, and cache HTTP requests. In this blog post, we will go through the step-by-step process of installing NGINX on Debian 11.

Step 1: Update the System

Before starting the installation process, it is important to update the Debian system to ensure that all the packages are up to date. To do this, run the following command:

sudo apt update && sudo apt upgrade

Step 2: Install NGINX

To install NGINX on Debian 11, run the following command:

sudo apt install nginx

This will install NGINX along with its dependencies. After the installation is complete, you can check the status of the NGINX service using the following command:

sudo systemctl status nginx

If NGINX is running, you will see a message indicating that the service is active.

Step 3: Configure Firewall

By default, Debian 11 comes with a firewall called nftables. If the firewall is enabled, you need to allow incoming HTTP and HTTPS traffic through the firewall. To do this, run the following commands:

sudo apt install nftables
sudo nft add rule inet filter input tcp dport {80,443} ct state new,established counter accept
sudo systemctl enable nftables
sudo systemctl start nftables

Step 4: Verify Installation

After installing NGINX and configuring the firewall, you can verify that NGINX is working by opening a web browser and navigating to the server’s IP address. If NGINX is running correctly, you will see the default NGINX welcome page.

Conclusion

In this blog post, we have gone through the step-by-step process of installing NGINX on Debian 11. By following these steps, you should now have a working installation of NGINX on your Debian 11 system.