How To Install Nginx, MariaDB, PHP (LEMP Stack) on Debian 11 | Holhol24

0 1

The LEMP stack, which stands for Linux (the working gadget), Nginx (the webserver), MariaDB/MySQL (the database), and PHP (the programming language), is the easiest platform to host traffic-intensive dynamic web pages and programs.

In this submit, we can see how one can Install LEMP Stack on Debian 11.

Prerequisites

To set up the LEMP stack on Debian 11, you want to have sudo privileges at the gadget.

Install LEMP Stack

Install Linux

Follow the Step by way of Step set up of Debian 11 or Upgrade Debian 10 “Buster” to Debian 11 “Bullseye”.

Proceed to the set up of AMP (Nginx v1.20, PHP-FPM v7.4, MariaDB v10.5) on Debian 11.

Install Nginx

Nginx is a loose, open-source webserver that gives HTTP, opposite proxy, caching, and load-balancing capability. It’s a really perfect choice to Apache, and it’s simple to arrange.

Install underneath programs.

sudo apt replace

sudo apt set up -y curl gnupg2 ca-certificates lsb-release

Download the Nginx repository signing key and upload it to the gadget.

wget http://nginx.org/keys/nginx_signing.key

gpg --no-default-keyring --keyring ./nginx_signing_key_temp.gpg --import ./nginx_signing.key

gpg --no-default-keyring --keyring ./nginx_signing_key_temp.gpg --export > ./nginx_signing_key.gpg

sudo mv nginx_signing_key.gpg /and so forth/apt/relied on.gpg.d/

Add Nginx repository to the gadget.

echo "deb http://nginx.org/packages/debian `lsb_release -cs` nginx" | sudo tee /and so forth/apt/assets.record.d/nginx.record

Install Nginx package deal the usage of the next command.

sudo apt replace

sudo apt set up -y nginx

Start the Nginx provider after the set up.

sudo systemctl get started nginx

Open a internet browser and consult with the underneath URL.

http://your-ip-add-ress

You gets the welcome web page that confirms that Nginx has been effectively put in and is up and working.

Nginx Default Page

Nginx’s default record root in Debian 11 is /usr/percentage/nginx/html/. The configuration recordsdata are discovered below /and so forth/nginx/ listing.

Install MariaDB

MariaDB is a drop-in alternative for MySQL that helps all usual MySQL options. We will arrange MariaDB as a part of a LEMP (Linux, Nginx, MariaDB/MySQL, PHP) stack in our set up.

Install the MariaDB server v10.5 from the Debian repository.

sudo apt set up -y mariadb-server mariadb-client

MariaDB provider will have to be up and working at this second. First, take a look at the standing of the MariaDB provider the usage of the underneath command.

sudo systemctl standing mariadb

Next, make the MariaDB server protected by way of working the mysql_secure_installation command.

Install PHP

The PHP FastCGI Process Manager (FPM) is an alternate PHP FastCGI implementation with further options helpful for larger and busier websites. It can deal with much more requests according to 2nd than different PHP FastCGI implementations.

Install php-fpm package deal and PHP MySQL extension.

sudo apt set up -y php-fpm php-mysql php-cli

Edit the configuration document.

sudo nano /and so forth/php/7.4/fpm/pool.d/www.conf

Change the possession and team from www-data to nginx for Unix socket.

pay attention.proprietor = nginx
pay attention.team = nginx

Create Virtual Host

Now, create a digital host at the Nginx server for the next main points to check the LEMP stack.

Server Name: web site.holhol24.native
Document Root : /usr/percentage/nginx/html/web site.holhol24.native

Create a digital host configuration document web site.holhol24.native.conf in /and so forth/nginx/conf.d/ listing.

sudo nano /and so forth/nginx/conf.d/web site.holhol24.native.conf

Add the next content material.

server https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/{
   server_name web site.holhol24.native;
   root /usr/percentage/nginx/html/web site.holhol24.native;

   location / https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/{
       index index.html index.htm index.php;
   }

   location ~ .php$ https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/{
      come with /and so forth/nginx/fastcgi_params;
      fastcgi_pass unix:/run/php/php7.4-fpm.sock;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME /usr/percentage/nginx/html/web site.holhol24.native$fastcgi_script_name;
   }
}

Create the record root listing for the digital host.

sudo mkdir /usr/percentage/nginx/html/web site.holhol24.native

Place a PHP document onto the record root.

echo "" | sudo tee /usr/percentage/nginx/html/web site.holhol24.native/index.php

Restart the Nginx and PHP-FPM products and services.

sudo systemctl restart nginx

sudo systemctl restart php7.4-fpm

Test LEMP Stack

First, create a number access to your area (web site.holhol24.native) within the /and so forth/hosts document to check the LEMP stack in the neighborhood. Then, open up your internet browser and sort your area identify within the internet deal with.

http://web site.holhol24.native

The web page will seem like underneath:

As you’ll see within the screenshot, the PHP is operating via FPM/FastCGI (Server API).

PHP Information
PHP Information

Scroll the web page additional right down to view the PHP improve for MySQL, XML, and different extensions.

Conclusion

I’m hoping this submit helped you to put in the LEMP stack on Debian 11. Please percentage your comments within the feedback phase.

Leave A Reply

Your email address will not be published.

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

I agree to these terms.