HomeDEBIANInstall Nginx Web Server on Debian 11

Install Nginx Web Server on Debian 11

We will walk you through how to Install Nginx Web server on Debian 11 system in this informative tutorial, and you can also learn about Nginx’s fundamental workflow.

Nginx is a free and open-source web server that can host a wide range of websites and applications.
The software is well-known for its low memory footprint, high scalability, and modular, event-driven architecture, which provides secure, predictable performance.
Nginx is more than a web server; it also serves as a load balancer, an HTTP cache, and a reverse proxy.

Install Nginx Web Server on Debian 11

To get started installing Nginx on a Debian 11 system, follow the steps below.

Step 1: Update the Debian 11 system

In order to reflect the most recent upstream changes, first update your local package index:

sudo apt update

Step 2: Install Nginx Web Server on Debian 11

Nginx can be installed using customary package management tools because it is part of Debian’s usual software repositories.

sudo apt install nginx

Sample output:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  geoip-database libgeoip1 libnginx-mod-http-geoip libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter
  libnginx-mod-mail libnginx-mod-stream libnginx-mod-stream-geoip nginx-common nginx-core
Suggested packages:
  geoip-bin fcgiwrap nginx-doc
The following NEW packages will be installed:
  geoip-database libgeoip1 libnginx-mod-http-geoip libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter
  libnginx-mod-mail libnginx-mod-stream libnginx-mod-stream-geoip nginx nginx-common nginx-core
0 upgraded, 11 newly installed, 0 to remove and 83 not upgraded.
Need to get 4,541 kB of archives.
After this operation, 13.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

You should already be running the Nginx web server. You can put this to the test by running the following command:

systemctl status nginx

Sample output:

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) since Tue 2023-02-14 05:12:59 EST; 45min ago
       Docs: man:nginx(8)
    Process: 20629 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 20630 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 20735 (nginx)
      Tasks: 3 (limit: 4657)
     Memory: 4.1M
        CPU: 76ms
     CGroup: /system.slice/nginx.service
             ├─20735 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             ├─20738 nginx: worker process
             └─20739 nginx: worker process

You can find out what version of Nginx is installed by typing:

$ sudo nginx -v
nginx version: nginx/1.18.0

Nginx can be started, stopped, and restarted by typing:

sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx

Step 3: Firewall Modification

It is important to change the firewall settings to permit outside access to the default web ports before testing Nginx.

You can list the ufw application profiles by typing:

sudo ufw app list

Sample output:

Available applications:
  AIM
  Bonjour
  CIFS
  CUPS
  DNS
  Deluge
  IMAP
  IMAPS
  IPP
  KTorrent
  Kerberos Admin
  Kerberos Full
  Kerberos KDC
  Kerberos Password
  LDAP
  LDAPS
  LPD
  MSN
  MSN SSL
  Mail submission
  NFS
  Nginx Full
  Nginx HTTP
  Nginx HTTPS
  POP3
  POP3S
  PeopleNearby
  SMTP
  SSH
  Socks
  Telnet
  Transmission
  Transparent Proxy
  VNC
  WWW
  WWW Cache
  WWW Full
  WWW Secure
  XMPP
  Yahoo
  qBittorrent
  svnserve

Look at this:

Nginx Full: This profile allows access to both port 443 and port 80, which are used for TLS/SSL-encrypted traffic.

Nginx HTTP: This profile only allows access to port 80. (normal, unencrypted web traffic).

Nginx HTTPS: This profile only allows access to port 443 (TLS/SSL encrypted traffic).

Because you haven’t yet configured TLS/SSL for your server in this guide, you will only need to allow HTTP traffic on port 80.

Allow by executing the command below:

$ sudo ufw allow 'Nginx HTTP'
Rules updated
Rules updated (v6)

Check the status:

sudo ufw status

Sample output:

Status: active

To                         Action      From
--                         ------      ----
10000                      ALLOW       Anywhere                  
Nginx HTTP                 ALLOW       Anywhere                  
22/tcp                     ALLOW       Anywhere                  
10000 (v6)                 ALLOW       Anywhere (v6)             
Nginx HTTP (v6)            ALLOW       Anywhere (v6)             
22/tcp (v6)                ALLOW       Anywhere (v6)

Step 4: Using Nginx Web Server on Debian 11

If you enter the public IP address or FQDN of your server into your browser, you will be taken to the default Nginx landing page.
You may find your server’s public IP address if you don’t already know it by typing:

hostname -I

Enter the IP address of your server in the browser once you have it:

http://your_server_ip

Nginx’s default landing page should display the message “Welcome to Nginx.”

install-nginx-debian-test-page

Congratulations! Nginx has been installed successfully on Debian 11.

Conclusion

This guide demonstrated how to set up the Nginx web server on Debian 11. We talked about its fundamentals, installation, and some fundamental configuration options. This should have been useful, we hope.

Read more about Nginx.

See more:

Install KDE Desktop Environment on Ubuntu 22.04|20.04

How To Install TeamViewer on Ubuntu 22.04|20.04

How To Install Google Chrome on Ubuntu 22.04|20.04

Install LAMP Stack on Ubuntu 22.04|20.04

Install MariaDB Database on Rocky Linux 9|AlmaLinux

- Advertisment -

Recent posts

LEAVE A REPLY

Please enter your comment!
Please enter your name here