This guide shows you how to prepare a clean Debian 13 (Trixie) server environment for Drupal 11 using only native, official repository packages. You will install and configure PostgreSQL 17, Apache 2.4 (Event MPM), PHP 8.4-FPM, as well as Composer 2.x. This lightweight, production-ready stack is optimized for speed, security, and low memory consumption.
0. A Gentle Reminder Before You Start
Running administrative commands directly as the root user is a dangerous server administration habit. A simple typo can easily compromise or destroy your system. For production-grade security, always perform server operations using a regular user account with sudo privileges.
Check out my own experience, Zero Downtime: An Epic Post-Mortem of a Live Website Server Rescue, to see how a single, tiny typo almost ruined my entire web server.
To be clear, using a regular user with sudo privileges does not automatically eliminate all risks, but the physical act of typing the sudo prefix serves as a psychological buffer—forcing you to pause, double-check, and proceed with extreme caution.
If you are currently logged in as root, I strongly recommend you create a regular user account with the cli command adduser. It is a user-friendly, high-level script that automatically creates the home directory (/home/username), copies basic configuration files (like .bashrc), prompts you to set a password, and sets /bin/bash as the default shell:
# Create a new user (replace 'your_username' with your actual username)
adduser your_username
# Add the new user to the sudo group
usermod -aG sudo your_username
# Switch to your new user
su - your_usernameFor the rest of this guide, ensure all commands are executed using this sudo user.
1. Drupal 11 System Requirements
Now that your server is secured, let's look at Drupal 11's official baseline requirements and why Debian 13 (Trixie) is the perfect match:
- PHP: PHP 8.3 or higher is mandatory. PHP 8.4 is fully supported and recommended for the latest performance improvements.
- Database: PostgreSQL 16 or higher is required. PostgreSQL 17 is fully supported.
- Web Server: Apache 2.4 or higher (configured with the Event MPM) or Nginx.
- Composer: Composer 2.7.x or higher is required.
Because Debian 13 (Trixie) natively packages all of these bleeding-edge versions in its main stable repositories, we can build a pure, vanilla environment that is incredibly easy to maintain and update.
2. Required Packages Installation Step by Step
Before installing any software, update the default Debian 13 package database:
sudo apt update && sudo apt upgrade -y
Step 1: Install PostgreSQL 17
We will install the database layer first. Since Debian 13 (Trixie) natively packages PostgreSQL 17 in its official main repositories, we can deploy it directly without adding any third-party Apt sources or signing keys. This ensures a clean, easily maintainable database foundation.
Run the following command to install PostgreSQL:
sudo apt install -y postgresqlOnce the installation is complete, the PostgreSQL service will automatically start and be enabled to run on system boot. You can verify that the service is active and running with:
sudo systemctl status postgresql
postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: enabled)
Active: active (exited) since Thu 2026-06-11 10:36:25 CDT; 1min 7s ago
Invocation: 88e0b11117b546d58bd25422d481fc0a
Main PID: 4008 (code=exited, status=0/SUCCESS)
Mem peak: 1.8M
CPU: 5ms
Jun 11 10:36:25 debian systemd[1]: Starting postgresql.service - PostgreSQL RDBMS...
Jun 11 10:36:25 debian systemd[1]: Finished postgresql.service - PostgreSQL RDBMS.Note on active (exited):
Do not be alarmed if you see Active: active (exited) in the output. In Debian, postgresql.service is a "meta-service" designed to trigger and manage version-specific database clusters. It exits successfully once it completes this orchestration.
To confirm that PostgreSQL 17 is actively running and accepting connections, you can use either of the following two foolproof methods:
Method A: Check the Version-Specific Cluster Service
Run status against the actual running instance service (postgresql@17-main):
sudo systemctl status postgresql@17-main
# This should display: Active: active (running)
Method B: Use the pg_isready Tool (Recommended)
PostgreSQL comes with a built-in utility specifically designed to check server connectivity. Simply run:
pg_isready
# Expected output: /var/run/postgresql:5432 - accepting connectionsFinally, to confirm the installed client and server version, run:
psql --version
# Output should display: psql (PostgreSQL) 17.10 (Debian 17.10-0+deb13u1)
Setting Up the Database and User for Drupal
Please note that this guide focuses strictly on preparing the server running environment. If you are ready to create your PostgreSQL database, database user, and configure the necessary schema permissions specifically for your Drupal installation, please refer to Step 2: Prepare the PostgreSQL 16 Database of my previous article: Install Drupal CMS 2.0 on Ubuntu 24.04 with Apache2, PHP 8.3, and PostgreSQL 16.
Step 2: Install Apache2
Next, we will set up our web server. While Nginx is popular, Apache remains a powerhouse for Drupal due to its native support for .htaccess files (which Drupal uses heavily for security and routing).
By combining Apache with the Event MPM and HTTP/2, we get the best of both worlds: the raw concurrency performance of Nginx, and the flexible configuration of Apache.
Run the following command to install Apache 2.4:
sudo apt install -y apache21. Optimization: Verify Event MPM and Enable HTTP/2
Debian 13 natively configures Apache to use the modern Event MPM by default when legacy PHP modules are not loaded. To leverage modern browser parallel loading, let's enable the HTTP/2 module:
# Enable HTTP/2 support
sudo a2enmod http22. Enable Required Apache Modules for Drupal 11
Drupal requires clean URLs (managed via .htaccess), and we need FPM proxying capabilities to communicate with PHP 8.4-FPM later. Enable these essential modules with a single command:
# Enable rewrite, ssl, security headers, and FPM proxy modules
sudo a2enmod rewrite ssl headers proxy_fcgi setenvif3. Test Configuration & Restart Apache
Before restarting, it is a system administrator's best practice to test the Apache configuration syntax to ensure there are no typos:
sudo apache2ctl configtest
# Expected output: Syntax OKIf the syntax is OK, enable Apache to run on system boot and restart the service to apply all module changes:
sudo systemctl enable apache2
sudo systemctl restart apache2To verify the web server is running and active:
sudo systemctl status apache2Configuring your Apache Virtual Host for Drupal
Please note that this guide focuses strictly on preparing the server running environment. If you are ready to configure a custom Apache Virtual Host (directory permissions, server blocks, and clean URL routing) specifically for your Drupal site, please refer to Step 1: Configure the Apache Virtual Host of my previous article: Install Drupal CMS 2.0 on Ubuntu 24.04 with Apache2, PHP 8.3, and PostgreSQL 16.
Step 3: Install PHP 8.4 and Enable PHP-FPM
To connect our Apache web server with the PostgreSQL database, we need to install PHP. Since Debian 13 (Trixie) natively ships with PHP 8.4 in its default repositories, we can install the raw packages directly without adding any external PPAs or untrusted third-party signing keys.
1. Install PHP 8.4-FPM and Required Drupal Extensions
Run the following command to install the PHP 8.4-FPM service along with the precise list of extensions required by Drupal 11 (note that php8.4-xml natively provides DOM and XML capabilities in Debian 13, keeping our dependencies clean):
sudo apt install -y php8.4-fpm php8.4-cli php8.4-common php8.4-pgsql \
php8.4-gd php8.4-xml php8.4-mbstring php8.4-curl php8.4-zip \
php8.4-apcu php8.4-opcache php8.4-intl php8.4-bcmath1. Enable PHP-FPM in Apache
With both Apache2 and PHP-FPM installed, we can now bridge them together. Enable the pre-configured Apache configuration block for PHP 8.4-FPM:
# Register PHP 8.4-FPM with Apache
sudo a2enconf php8.4-fpmNow, restart both the PHP-FPM daemon and Apache to apply the new integration:
sudo systemctl restart php8.4-fpm
sudo systemctl restart apache2
Ensure PHP-FPM is configured to run on system boot:
sudo systemctl enable php8.4-fpm2. Verify the Installation
To verify that the command-line interface (CLI) is successfully running the correct native PHP version:
php -v
PHP 8.4.21 (cli) (built: May 8 2026 05:56:48) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.21, Copyright (c) Zend Technologies
with Zend OPcache v8.4.21, Copyright (c), by Zend TechnologiesTo confirm that the PHP-FPM service is actively running and listening on its Unix socket:
sudo systemctl status php8.4-fpm
# Output should show: Active: active (running)Step 4: Install Composer 2 (Required) and Git (Recommended)
To manage Drupal 11's core files, security updates, and contributed modules, a package manager is no longer optional. In modern web development, Composer 2 is strictly required to build and maintain a Drupal site. On the other hand, Git is not mandatory for running Drupal but is highly recommended to manage your codebase, track development versions, and support Composer during certain source-cloning operations.
1. Install Composer 2 Globally (Required)
We will first download the official Composer installer and move the binary to a global system directory. This allows you to run the composer command from any directory on your server.
Since curl is often missing on minimal Debian server installations, we will install it first before running the Composer installer script:
# Ensure curl is installed
sudo apt install -y curl
# Download and execute the Composer installer
curl -sS https://getcomposer.org/installer | php
# Move the binary to your global path and make it executable
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer2. Install Git and Unzip (Recommended)
First, we will install Git and the unzip utility. Having unzip installed on your system is highly recommended because it allows Composer to extract downloaded package archives significantly faster than downloading raw files.
Run the following command using your sudo user:
sudo apt install -y git unzip3. Verify the Installations
Confirm both tools are installed and accessible by checking their respective versions:
# Verify Composer
composer --version
Composer version 2.10.1 2026-06-04 10:25:59
PHP version 8.4.21 (/usr/bin/php8.4)
Run the "diagnose" command to get more detailed diagnostics output.
# Verify Git
git --version
git version 2.47.33. Connecting Apache to PHP8.4-FPM
Now that both Apache and PHP-FPM are installed, we need to bridge them. In modern web environments, we configure Apache to proxy PHP requests to an isolated background service instead of embedding PHP inside Apache processes.
1. Why Choose PHP-FPM over mod_php?
- Memory Efficiency: With mod_php, the entire PHP interpreter is loaded into every single Apache worker. Even when serving a static image, Apache wastes massive memory. With PHP-FPM, Apache handles static files at lightning speed and only offloads dynamic PHP tasks to the separate FPM pool.
- Process Isolation: If a PHP script crashes or runs out of memory, it only crashes that specific PHP-FPM worker thread. Your Apache web server remains completely unaffected and online.
- Granular Control: You can fine-tune PHP-FPM resource allocation (such as max_children and execution timeouts) independently from your web server's connection limits.
2. How to Enable PHP-FPM in Your Virtual Host
To tell Apache to hand off dynamic PHP files to the PHP 8.4-FPM service, add the following <FilesMatch> directive inside your Virtual Host configuration file:
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.4-fpm.sock|fcgi://localhost"
</FilesMatch>This SetHandler directive intercepts any request ending in .php and routes it through a high-speed Unix Domain Socket (/run/php/php8.4-fpm.sock) directly to the PHP-FPM backend using the FastCGI (fcgi://) protocol. Unix domain sockets handle inter-process communication directly in the OS kernel, bypassing the local network stack overhead for maximum performance.
After applying this block, restart Apache to apply the high-performance bridge:
sudo systemctl restart apache23. Looking for a Complete Virtual Host Template?
If you are setting up your first-ever virtual host and need to see where to place this <FilesMatch> block within a complete Apache configuration file, please refer back to Step 1: Configure the Apache Virtual Host of my previous article: Install Drupal CMS 2.0 on Ubuntu 24.04 with Apache2, PHP 8.3, and PostgreSQL 16.
Conclusion
By setting up Apache with the Event MPM, utilizing native PHP 8.4-FPM, and establishing a robust PostgreSQL 17 database on Debian 13 (Trixie), you have constructed a rock-solid, enterprise-grade foundation designed to unlock the maximum performance of Drupal 11.
The greatest advantage of this setup is its purity. By sticking strictly to native, official Debian repositories and avoiding bloated third-party PPAs, you have minimized your server’s attack surface and ensured that future OS security updates will be seamless, predictable, and worry-free.
Now, your server is primed and ready. Go ahead, spin up your Composer project, and start building your high-performance digital assets.
If you encountered any hiccups during your setup or have any optimization tips of your own, feel free to drop a comment below or share your experiences. Happy building!