Installing Apache2, PHP, MariaDB, phpMyAdmin and ModSecurity on Debian 13

This forum is dedicated to Debian GNU/Linux, one of the most stable and trusted free operating systems. Discuss Debian installation, package management, server administration, security updates, systemd and troubleshooting for desktop and server systems.
Post Reply
Admin
Site Admin
Posts: 81
Joined: Fri Feb 27, 2026 7:36 am
Contact:

Installing Apache2, PHP, MariaDB, phpMyAdmin and ModSecurity on Debian 13

Post by Admin »

Installing Apache2, PHP, phpMyAdmin and ModSecurity on Debian 13

This guide shows how to install a complete web server stack on Debian 13, including:
  • Apache2 (Web Server)
  • PHP (Backend language)
  • phpMyAdmin (Database management)
  • ModSecurity (Web Application Firewall)

1. Update the System

Code: Select all

apt update && apt upgrade -y

2. Install Apache2

Code: Select all

apt install apache2 -y
Start and enable Apache:

Code: Select all

systemctl enable apache2
systemctl start apache2
Check status:

Code: Select all

systemctl status apache2
Test in browser:
http://your-server-ip


3. Install PHP

Debian 13 typically ships with PHP 8.4+

Code: Select all

apt install php php-cli php-fpm php-mysql php-curl php-gd php-xml php-mbstring php-zip php-intl -y
Enable PHP in Apache:

Code: Select all

a2enmod proxy_fcgi setenvif
a2enconf php*-fpm
systemctl reload apache2
Test PHP:

Code: Select all

echo "<?php phpinfo(); ?>" > /var/www/html/info.php
Open:
http://your-server-ip/info.php


4. Install MariaDB (Database)

Code: Select all

apt install mariadb-server -y
Secure installation:

Code: Select all

mysql_secure_installation
5. Install phpMyAdmin

Code: Select all

apt install php
login to view the rest of this post
Post Reply