Skip to content

Linux VPS & VPS Windows Setup Guide | NetCloud24 LEMP Stack (Nginx, PHP, and MariaDB) on Debian 12

Netcloud24
Cloud Infrastructure Expert
HOSTING H1

Free web hosting H1

5 GB of storage and SSL for a small website or WordPress project.

Explore hosting H1
WINDOWS VPS + RDS

Run Windows applications remotely

Windows Server 2022 or 2025 and RDS CALs included in the plan. Choose resources and user capacity for your business.

Explore Windows VPS
NetCloud24 Expert Guides Open the dedicated video page

Video transcript: NetCloud24 Expert Guides. Practical knowledge for a reliable cloud. Cloud and VPS expertise, security, performance, and step-by-step tutorials. Learn, deploy, and keep building with NetCloud24.

 

 

Introduction

The LEMP stack, which consists of Linux, Nginx, PHP, and MariaDB, is a popular choice for hosting dynamic websites and applications. This guide will walk you through the steps to install the LEMP stack on Debian 12, ensuring you have a robust environment for your web projects. Utilizing a can further enhance your deployment capabilities.

Prerequisites

  • A server running Debian 12
  • Root or sudo access to the server
  • An internet connection to download packages

Step 1: Update Your System

Before installing the LEMP stack, update your package list and upgrade the existing packages:

sudo apt update && sudo apt upgrade -y

Step 2: Install Nginx

To install Nginx, use the following command:

sudo apt install nginx -y

After installation, start Nginx and enable it to run on boot:

sudo systemctl start nginx
sudo systemctl enable nginx

To verify that Nginx is running, open your web browser and navigate to your server’s IP address.

Visual overview of Linux VPS & VPS Windows Setup Guide | NetCloud24 LEMP Stack (Nginx, PHP, and MariaDB) on Debian 12
Visual overview: Linux VPS & VPS Windows Setup Guide | NetCloud24 LEMP Stack (Nginx, PHP, and MariaDB) on Debian 12

Step 3: Install MariaDB

Next, install MariaDB, which will serve as your database management system:

sudo apt install mariadb-server -y

After the installation, secure your MariaDB installation:

sudo mysql_secure_installation

Follow the prompts to set a root password and secure your installation.

Step 4: Install PHP

Install PHP along with the necessary PHP extensions for Nginx and MariaDB:

sudo apt install php-fpm php-mysql -y

Step 5: Configure Nginx to Use PHP

Edit the default Nginx server block configuration:

sudo nano /etc/nginx/sites-available/default

Find the section that begins with server { and modify it to include the following lines to handle PHP files:

Key topics covered in Linux VPS & VPS Windows Setup Guide | NetCloud24 LEMP Stack (Nginx, PHP, and MariaDB) on Debian 12
Key topics covered in this NetCloud24 guide.
location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # Update PHP version if necessary
}

After making changes, test the Nginx configuration:

sudo nginx -t

If the configuration test is successful, restart Nginx:

sudo systemctl restart nginx

Step 6: Create a PHP Info File

To verify that PHP is working with Nginx, create a PHP info file:

echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php

Now, open your web browser and navigate to http://your_server_ip/info.php. You should see the PHP information page.

Step 7: Conclusion

You have successfully installed the LEMP stack (Nginx, PHP, and MariaDB) on Debian 12. This setup provides a powerful platform for hosting web applications. For those interested in enhanced performance and reliability, consider utilizing a . You can explore various options, such as , including Windows VPSVirtual Private Server Hosting and Windows VPS Hosting UK for your server needs.

© 2024 LEMP Stack Installation Tutorial. All rights reserved.

Linux VPS & VPS Windows Setup Guide | NetCloud24 LEMP Stack (Nginx, PHP, and MariaDB) on Debian 12
Linux VPS & VPS Windows Setup Guide | NetCloud24 LEMP Stack (Nginx, PHP, and MariaDB) on Debian 12
Explore more

More on this topic

Netcloud24
Netcloud24
Cloud Infrastructure Expert · NetCloud24

Comments are closed.

Linux VPS & VPS Windows Setup Guide | NetCloud24 LEMP Stack (Nginx, PHP, and MariaDB) on Debian 12

Netcloud24
Cloud Infrastructure Expert
HOSTING H1

Free web hosting H1

5 GB of storage and SSL for a small website or WordPress project.

Explore hosting H1
WINDOWS VPS + RDS

Run Windows applications remotely

Windows Server 2022 or 2025 and RDS CALs included in the plan. Choose resources and user capacity for your business.

Explore Windows VPS
NetCloud24 Expert Guides Open the dedicated video page

Video transcript: NetCloud24 Expert Guides. Practical knowledge for a reliable cloud. Cloud and VPS expertise, security, performance, and step-by-step tutorials. Learn, deploy, and keep building with NetCloud24.

 

 

Introduction

The LEMP stack, which consists of Linux, Nginx, PHP, and MariaDB, is a popular choice for hosting dynamic websites and applications. This guide will walk you through the steps to install the LEMP stack on Debian 12, ensuring you have a robust environment for your web projects. Utilizing a can further enhance your deployment capabilities.

Prerequisites

  • A server running Debian 12
  • Root or sudo access to the server
  • An internet connection to download packages

Step 1: Update Your System

Before installing the LEMP stack, update your package list and upgrade the existing packages:

sudo apt update && sudo apt upgrade -y

Step 2: Install Nginx

To install Nginx, use the following command:

sudo apt install nginx -y

After installation, start Nginx and enable it to run on boot:

sudo systemctl start nginx
sudo systemctl enable nginx

To verify that Nginx is running, open your web browser and navigate to your server’s IP address.

Visual overview of Linux VPS & VPS Windows Setup Guide | NetCloud24 LEMP Stack (Nginx, PHP, and MariaDB) on Debian 12
Visual overview: Linux VPS & VPS Windows Setup Guide | NetCloud24 LEMP Stack (Nginx, PHP, and MariaDB) on Debian 12

Step 3: Install MariaDB

Next, install MariaDB, which will serve as your database management system:

sudo apt install mariadb-server -y

After the installation, secure your MariaDB installation:

sudo mysql_secure_installation

Follow the prompts to set a root password and secure your installation.

Step 4: Install PHP

Install PHP along with the necessary PHP extensions for Nginx and MariaDB:

sudo apt install php-fpm php-mysql -y

Step 5: Configure Nginx to Use PHP

Edit the default Nginx server block configuration:

sudo nano /etc/nginx/sites-available/default

Find the section that begins with server { and modify it to include the following lines to handle PHP files:

Key topics covered in Linux VPS & VPS Windows Setup Guide | NetCloud24 LEMP Stack (Nginx, PHP, and MariaDB) on Debian 12
Key topics covered in this NetCloud24 guide.
location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # Update PHP version if necessary
}

After making changes, test the Nginx configuration:

sudo nginx -t

If the configuration test is successful, restart Nginx:

sudo systemctl restart nginx

Step 6: Create a PHP Info File

To verify that PHP is working with Nginx, create a PHP info file:

echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php

Now, open your web browser and navigate to http://your_server_ip/info.php. You should see the PHP information page.

Step 7: Conclusion

You have successfully installed the LEMP stack (Nginx, PHP, and MariaDB) on Debian 12. This setup provides a powerful platform for hosting web applications. For those interested in enhanced performance and reliability, consider utilizing a . You can explore various options, such as , including Windows VPSVirtual Private Server Hosting and Windows VPS Hosting UK for your server needs.

© 2024 LEMP Stack Installation Tutorial. All rights reserved.

Linux VPS & VPS Windows Setup Guide | NetCloud24 LEMP Stack (Nginx, PHP, and MariaDB) on Debian 12
Linux VPS & VPS Windows Setup Guide | NetCloud24 LEMP Stack (Nginx, PHP, and MariaDB) on Debian 12
Explore more

More on this topic

Netcloud24
Netcloud24
Cloud Infrastructure Expert · NetCloud24

Comments are closed.