How to Install phpBB with Nginx on Debian 13, 12 and 11

Install phpBB with Nginx on Debian 13, 12, or 11 using MariaDB and PHP-FPM. Covers PHP branch choice, checksums, HTTPS, cron, and removal.

Last updatedAuthorJoshua JamesRead time10 minGuide typeDebian

Running a self-hosted forum is easier when the stack stays predictable, and phpBB still fits that job well with Nginx, MariaDB, and PHP-FPM. That makes it practical to install phpBB with Nginx on Debian 13 (trixie), Debian 12 (bookworm), or Debian 11 (bullseye), as long as the PHP branch stays within phpBB 3.3.x support.

phpBB 3.3.x works cleanly on Debian 12 and Debian 11 with Debian’s default PHP packages. On Debian 13, install PHP 8.3 on Debian first because the current phpBB 3.3.16 install docs support PHP up to 8.3, while Debian 13 defaults to PHP 8.4. The phpBB 4.0 tags available now are alpha releases, so keep production boards on the supported 3.3.x path unless upstream guidance changes.

Install phpBB on Debian

Supported releases for this phpBB 3.3.x path are Debian 12 (bookworm) and Debian 11 (bullseye) with Debian’s default PHP packages, plus Debian 13 (trixie) after you install PHP 8.3. Do not use Debian 13’s default PHP 8.4 packages for this phpBB 3.3.x workflow.

Install the Nginx, MariaDB, and Utility Packages on Debian

Start by refreshing the package lists and applying pending upgrades so the web stack installs against current Debian packages.

sudo apt update && sudo apt upgrade -y

These commands use sudo for system changes. If your account does not have sudo access yet, use Add a User to Sudoers on Debian first.

Install the shared stack pieces first. Nginx, MariaDB, curl, wget, unzip, and jq are common to every supported Debian release. The PHP packages come in the next section because Debian 13 needs PHP 8.3 instead of its default PHP 8.4 for phpBB 3.3.x.

sudo apt install nginx mariadb-server curl wget unzip jq -y

For separate stack setup details, see Install Nginx on Debian, Install MariaDB on Debian, and Install PHP on Debian.

Verify Nginx and MariaDB on Debian

Confirm that both services started correctly before you move on to phpBB itself.

systemctl is-active nginx mariadb
active
active

If either service is inactive, start it now with sudo systemctl enable --now nginx mariadb and rerun the same status checks.

Once Nginx is up, opening http://your-server-ip in a browser should show the default welcome page.

Install the Correct PHP Branch for phpBB 3.3.x on Debian

phpBB 3.3.16 still caps official PHP support at 8.3, so Debian 13 needs a different PHP path than Debian 12 or Debian 11. Set the PHP branch first, then keep using the same PHP_VERSION variable through the remaining commands.

Debian 13: Install PHP 8.3 Before Continuing

Debian 13 defaults to PHP 8.4, which falls outside phpBB 3.3.x’s documented PHP range. Use PHP 8.3 on Debian to add Sury’s third-party APT repository first, then install the exact PHP 8.3 packages phpBB needs for PHP-FPM, CLI tasks, MySQLi, mbstring, and XML support.

sudo apt install php8.3-fpm php8.3-cli php8.3-mysql php8.3-mbstring php8.3-xml -y
export PHP_VERSION=8.3

Debian 12 and Debian 11: Use the Default PHP Packages

Debian 12 and Debian 11 stay inside phpBB 3.3.x’s documented PHP range with the default APT packages, so install the PHP stack directly.

sudo apt install php-fpm php-cli php-mysql php-mbstring php-xml -y

After installation, derive the PHP branch from the default PHP CLI so later service, socket, and configuration commands stay aligned with the release you are using. The command prints 8.2 on Debian 12 and 7.4 on Debian 11.

PHP_VERSION="$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;')"
printf '%s\n' "$PHP_VERSION"

On Debian 13, do not derive PHP_VERSION from the default php command while it still points to PHP 8.4. Keep PHP_VERSION=8.3 for this phpBB 3.3.x setup unless you deliberately changed the default CLI binary to PHP 8.3.

Verify the Selected PHP-FPM Service and phpBB Modules

Debian uses versioned PHP-FPM service units such as php8.3-fpm, php8.2-fpm, and php7.4-fpm. Verify the branch you selected before moving on; the sample output here shows a Debian 13 host using PHP 8.3.

php$PHP_VERSION --version | head -n 1
systemctl is-active php$PHP_VERSION-fpm
PHP 8.3.30 (cli) (built: Feb 13 2026 15:52:05) (NTS)
active

Nginx can keep using the stable generic socket path even though the service unit stays versioned. Confirm that the symlink points at the PHP branch you selected.

readlink -f /run/php/php-fpm.sock
/run/php/php8.3-fpm.sock

Check the PHP modules phpBB expects before you configure the board.

php$PHP_VERSION -m | grep -E 'json|mbstring|xml|mysqli'
json
libxml
mbstring
mysqli
xml
xmlreader
xmlwriter

Download phpBB on Debian

Resolve the current stable phpBB 3.3.x release first, then download that exact archive in the same terminal session. The jq filter keeps stable 3.3.x tags and ignores release candidates or 4.0 alpha tags. If you want more download flag examples, see wget command examples and curl command usage in Linux.

resolve_phpbb_version() {
    PHPBB_TAG="$(curl -fsSL https://api.github.com/repos/phpbb/phpbb/tags?per_page=100 | jq -r '.[].name | select(test("^release-3\\.3\\.[0-9]+$"))' | head -n 1)"
    PHPBB_VERSION="${PHPBB_TAG#release-}"
    if [ -z "$PHPBB_VERSION" ]; then
        printf 'Unable to resolve the latest phpBB 3.3 release.\n' >&2
        return 1
    fi
    printf '%s\n' "$PHPBB_VERSION"
}
resolve_phpbb_version
3.3.16

Download the archive and its checksum, then verify the file before extracting it.

cd /tmp
wget https://download.phpbb.com/pub/release/3.3/$PHPBB_VERSION/phpBB-$PHPBB_VERSION.zip
wget https://download.phpbb.com/pub/release/3.3/$PHPBB_VERSION/phpBB-$PHPBB_VERSION.zip.sha256
sha256sum -c phpBB-$PHPBB_VERSION.zip.sha256
phpBB-3.3.16.zip: OK

Extract the verified archive and move phpBB into the web root.

cd /tmp
unzip phpBB-$PHPBB_VERSION.zip
sudo mv phpBB3 /var/www/html/phpbb

Set ownership first, then apply safer default file permissions before you expose the installer.

sudo chown -R www-data:www-data /var/www/html/phpbb
sudo find /var/www/html/phpbb -type d -exec chmod 755 {} \;
sudo find /var/www/html/phpbb -type f -exec chmod 644 {} \;
sudo chmod 777 /var/www/html/phpbb/cache /var/www/html/phpbb/files /var/www/html/phpbb/store /var/www/html/phpbb/images/avatars/upload

Those writable-directory permissions match phpBB’s own install docs for cache, files, store, and images/avatars/upload. If you later tighten them, confirm the ACP and attachment uploads still work before leaving the server unattended.

Confirm the extracted files and CLI entrypoint are in place.

stat -c '%A %U %G %n' /var/www/html/phpbb
stat -c '%A %U %G %n' /var/www/html/phpbb/bin/phpbbcli.php
drwxr-xr-x www-data www-data /var/www/html/phpbb
-rw-r--r-- www-data www-data /var/www/html/phpbb/bin/phpbbcli.php

Create the phpBB Database and User

Debian’s MariaDB packages default to local socket authentication for the administrative account, so open the database shell with sudo mariadb instead of forcing a root password workflow first.

sudo mariadb

Create the phpBB database and a dedicated local user from the MariaDB prompt.

CREATE DATABASE phpbb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'phpbbuser'@'localhost' IDENTIFIED BY 'replace_with_a_strong_password';
GRANT ALL PRIVILEGES ON phpbb.* TO 'phpbbuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace replace_with_a_strong_password with a unique password you can store safely. You will need the database name, username, and password during the web installer.

Verify that the database exists and the user entry was created.

sudo mariadb -e "SHOW DATABASES LIKE 'phpbb'; SELECT user, host FROM mysql.user WHERE user = 'phpbbuser';"
Database (phpbb)
phpbb

User      Host
phpbbuser localhost

Adjust PHP Settings for phpBB

phpBB runs with Debian’s defaults, but a few PHP-FPM limits are worth raising before you import extensions, upload attachments, or work with larger boards.

sudo nano /etc/php/$PHP_VERSION/fpm/php.ini

Update these values in the file:

max_execution_time = 180
max_input_time = 180
memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M

Restart the matching PHP-FPM service after saving the file.

sudo systemctl restart php$PHP_VERSION-fpm

Configure Nginx for phpBB on Debian

This server block stays close to phpBB’s shipped Nginx sample, but it uses Debian’s generic /run/php/php-fpm.sock socket so you do not need to rewrite the config for every PHP package update. It also raises Nginx’s request body limit to match the PHP upload size configured earlier.

sudo nano /etc/nginx/sites-available/phpbb.conf

Paste in the server block and replace the sample domain with your own forum hostname.

server {
    listen 80;
    listen [::]:80;
    server_name forums.example.com;

    root /var/www/html/phpbb;
    index index.php index.html index.htm;
    client_max_body_size 64M;

    access_log /var/log/nginx/phpbb.access.log;
    error_log /var/log/nginx/phpbb.error.log;

    location / {
        try_files $uri $uri/ @rewriteapp;
    }

    location @rewriteapp {
        rewrite ^(.*)$ /app.php/$1 last;
    }

    location /install/ {
        try_files $uri $uri/ @rewrite_installapp =404;
    }

    location @rewrite_installapp {
        rewrite ^(.*)$ /install/app.php/$1 last;
    }

    location ~ \.php(/|$) {
        include fastcgi.conf;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        fastcgi_pass unix:/run/php/php-fpm.sock;
    }

    location ~ /(config|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
        deny all;
        internal;
    }

    location ~ /\.svn|/\.git {
        deny all;
        internal;
    }
}

Enable the site, test the syntax, and reload Nginx only after the configuration passes.

sudo ln -s /etc/nginx/sites-available/phpbb.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Add HTTPS with Let’s Encrypt on Debian (Optional)

If your DNS already points at the server and port 80 is reachable, Certbot can add the HTTPS server block and redirect for you.

sudo apt install python3-certbot-nginx -y
sudo certbot --nginx --non-interactive --agree-tos --no-eff-email --redirect --hsts --staple-ocsp --email you@example.com -d forums.example.com

Use your real email address and forum hostname in that command. For renewal checks and extra hardening, see Secure Nginx with Let’s Encrypt on Debian.

Allow Web Traffic with UFW on Debian (Optional)

Only open firewall ports if UFW is already part of your server setup. If you still need to install it, follow Install UFW on Debian first.

If you are connected over SSH, allow SSH traffic before enabling or tightening UFW rules so you do not lock yourself out of the server.

sudo ufw allow ssh
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
443/tcp                    ALLOW       Anywhere
22/tcp (v6)                ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)
443/tcp (v6)               ALLOW       Anywhere (v6)

Complete the phpBB Web Installer on Debian

Once the backend stack is ready, open http://forums.example.com/install/app.php or https://forums.example.com/install/app.php if you already enabled HTTPS. The installer also responds from /install/, but the explicit app.php path makes it clear which entrypoint Nginx is serving.

Start the phpBB Installer

The first screen confirms that the installer is reachable. Click Install to move into the requirements check.

The requirements page should show the PHP modules and directory checks you prepared earlier. If everything passes, continue with the installer.

Create the phpBB Administrator Account

Set a strong administrator username, password, and email address here. phpBB does not create a default administrator password; this account becomes the first ACP administrator, so treat it like any other privileged production credential.

Enter the phpBB Database Details

Choose MySQL with MySQLi Extension, keep localhost for a local MariaDB server, and enter the database credentials you created earlier. The default table prefix phpbb_ is fine unless you plan to host multiple boards in the same database.

Finish the Server and Board Setup

Review the server URL settings, skip SMTP for now unless you already have mail relay details, and finish by naming the board and choosing the default language.

A successful run ends with the installer confirmation and a link into the ACP.

Secure and Maintain phpBB on Debian

Remove the Installer Directory

phpBB keeps the board locked down until you remove the installer directory, so do this as soon as the web setup is finished.

Your board remains inaccessible while /install/ is still present. phpBB treats that directory as a serious post-installation risk because it could let someone reopen the setup process.

sudo rm -rf /var/www/html/phpbb/install

Update phpBB Separately from Debian Packages

Debian APT updates Nginx, MariaDB, PHP, Certbot, and utility packages, but it does not update the phpBB files under /var/www/html/phpbb. Before applying a phpBB release, back up both the database and the board directory.

sudo mariadb-dump phpbb | gzip > "$HOME/phpbb-database-$(date +%F).sql.gz"
sudo tar -C /var/www/html -czf "$HOME/phpbb-files-$(date +%F).tar.gz" phpbb

Use the full package or changed-files package from the official phpBB 3.3 release directory, follow the updater for your current version, and remove the install directory again when the update finishes. Boards with modified core files should use phpBB’s changed-files or advanced update path instead of overwriting the whole tree.

Run phpBB Cron Jobs from the System Scheduler

phpBB can trigger maintenance tasks from visitor traffic, but a small system cron file is more predictable on a low-traffic board. Running the CLI command as www-data keeps cache and attachment ownership aligned with the web server.

printf '%s\n' '*/5 * * * * www-data /usr/bin/php /var/www/html/phpbb/bin/phpbbcli.php cron:run >/dev/null 2>&1' | sudo tee /etc/cron.d/phpbb > /dev/null
sudo chmod 644 /etc/cron.d/phpbb

Verify the cron file contents before you enable phpBB’s system cron option in the ACP.

sudo cat /etc/cron.d/phpbb
*/5 * * * * www-data /usr/bin/php /var/www/html/phpbb/bin/phpbbcli.php cron:run >/dev/null 2>&1

After that, switch phpBB to system cron inside the ACP so the board stops relying on web requests to process queued work.

At this point the board should be live, the installer should be gone, and background maintenance should no longer depend on page views.

Troubleshoot phpBB on Debian

Most setup failures on Debian come down to versioned PHP-FPM units, mismatched socket paths, MariaDB credentials, or writable-directory problems. These checks cover the common failure points.

PHP-FPM Unit or Socket Errors on Debian

If you copied a generic PHP-FPM service name from another distribution or older stack note, Debian will usually respond with a missing-unit error even though PHP-FPM is installed. A wrong or missing PHP-FPM socket can also surface as a 502 Bad Gateway response from Nginx.

Unit php-fpm.service could not be found.

Confirm the installed PHP branch, then query the matching service and the generic socket symlink.

PHP_VERSION="$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;')"
systemctl is-active php$PHP_VERSION-fpm
readlink -f /run/php/php-fpm.sock
active
/run/php/php8.2-fpm.sock

If the service is inactive, start it with sudo systemctl enable --now php$PHP_VERSION-fpm and rerun the same check. If your Nginx file still points at a hardcoded socket that does not exist, replace it with unix:/run/php/php-fpm.sock, then run sudo nginx -t and sudo systemctl reload nginx.

For a broader upstream checklist when the response stays at 502 after the socket is correct, see fix Nginx 502 Bad Gateway errors.

MariaDB Login or Privilege Errors for phpBB

If the installer rejects the database credentials, check that the database exists and that phpbbuser is limited to localhost with privileges on the phpbb database.

sudo mariadb -e "SHOW DATABASES LIKE 'phpbb'; SELECT user, host FROM mysql.user WHERE user = 'phpbbuser';"
Database (phpbb)
phpbb

User      Host
phpbbuser localhost

If either entry is missing, recreate the database and user with the SQL block from the install section, then retry the web installer.

File Write Errors for Cache, Store, or Avatars

Attachment uploads, cache writes, and avatar storage fail when the writable directories drift away from the permissions phpBB expects.

stat -c '%A %U %G %n' /var/www/html/phpbb/cache /var/www/html/phpbb/files /var/www/html/phpbb/store /var/www/html/phpbb/images/avatars/upload
drwxrwxrwx www-data www-data /var/www/html/phpbb/cache
drwxrwxrwx www-data www-data /var/www/html/phpbb/files
drwxrwxrwx www-data www-data /var/www/html/phpbb/store
drwxrwxrwx www-data www-data /var/www/html/phpbb/images/avatars/upload

If those paths are not writable, reapply ownership and the documented writable-directory permissions.

sudo chown -R www-data:www-data /var/www/html/phpbb
sudo chmod 777 /var/www/html/phpbb/cache /var/www/html/phpbb/files /var/www/html/phpbb/store /var/www/html/phpbb/images/avatars/upload

Attachment Uploads Return 413 Errors

If attachment uploads fail before phpBB can process them and Nginx returns a 413 response, the web server request limit is lower than the PHP upload limits. The phpBB server block sets client_max_body_size 64M; to match the PHP settings; if you changed that value, test and reload Nginx after saving the file.

sudo nginx -t
sudo systemctl reload nginx

For a deeper explanation of where Nginx applies that limit, see fix Nginx 413 Request Entity Too Large errors.

Check Let’s Encrypt Renewal on Debian

If HTTPS works today but renewal later fails, verify the system timer and run a dry-run renewal before the certificate gets close to expiry.

systemctl is-active certbot.timer
systemctl is-enabled certbot.timer
sudo certbot renew --dry-run
active
enabled
Congratulations, all simulated renewals succeeded.

Remove phpBB from Debian

If you no longer need the board, remove phpBB first, then decide whether the underlying Nginx, MariaDB, and PHP packages should stay for other sites or applications.

Remove the phpBB Files and Database

The next commands permanently delete the board files, uploaded attachments, cached data, and database contents. Export anything you want to keep before you continue.

sudo rm -rf /var/www/html/phpbb
sudo mariadb -e "DROP DATABASE IF EXISTS phpbb; DROP USER IF EXISTS 'phpbbuser'@'localhost'; FLUSH PRIVILEGES;"

Confirm that the database is gone.

sudo mariadb -e "SHOW DATABASES LIKE 'phpbb';"

No output means MariaDB no longer has a matching phpbb database.

Remove the Nginx Configuration and Optional Certificate

Delete the site definition, reload Nginx, and remove the certificate only if it was dedicated to this board.

sudo rm -f /etc/nginx/sites-enabled/phpbb.conf
sudo rm -f /etc/nginx/sites-available/phpbb.conf
sudo nginx -t
sudo systemctl reload nginx
sudo certbot delete --cert-name forums.example.com

Replace forums.example.com with the real certificate name if you created one for the board.

Remove the phpBB Cron File

Delete the cron drop-in if you created one for phpBB.

sudo rm -f /etc/cron.d/phpbb

Remove Optional UFW Rules

If the HTTP and HTTPS UFW rules were created only for this board and no other site uses them, delete those rules after the virtual host is gone. Keep the SSH allow rule unless you have another verified access path.

sudo ufw delete allow 80/tcp
sudo ufw delete allow 443/tcp
sudo ufw status

Remove the LEMP Packages from Debian (Optional)

Skip this step if any other site, API, or local tool still depends on Nginx, MariaDB, PHP-FPM, or the utility packages installed for this workflow. Removing the stack affects every workload sharing those services, and Debian 13 readers using PHP 8.3 from Sury need the versioned PHP removal path instead of only the default metapackages.

sudo apt remove --purge nginx nginx-common mariadb-server mariadb-client php-fpm php-cli php-mysql php-mbstring php-xml -y
sudo apt autoremove

If curl, wget, unzip, and jq were installed only for this phpBB workflow, remove those utilities separately. Leave them installed when other scripts, repositories, or maintenance tasks still use them.

sudo apt remove --purge curl wget unzip jq -y

If you installed PHP 8.3 on Debian 13 from the Sury repository, also remove the versioned PHP 8.3 packages used for phpBB and then follow Install PHP 8.3 on Debian for the repository cleanup.

sudo apt remove --purge php8.3-fpm php8.3-cli php8.3-mysql php8.3-mbstring php8.3-xml -y
sudo apt autoremove

Check that those packages are no longer installed before you delete MariaDB’s data directory.

dpkg -l nginx nginx-common mariadb-server mariadb-client php-fpm php-cli php-mysql php-mbstring php-xml | grep '^ii'

No output means those package names are no longer installed.

The MariaDB data directory contains every database on the host. Only remove it if you are sure nothing else on the server needs that data.

Inspect the path first, then skip the deletion if the directory is already gone or belongs to another MariaDB workload you plan to keep.

sudo ls -ld /var/lib/mysql
sudo rm -rf /var/lib/mysql

Conclusion

phpBB is now ready on Debian with Nginx, MariaDB, and PHP-FPM aligned to phpBB 3.3.x’s supported PHP range. If you want to harden the web stack further, review Secure Nginx with Let’s Encrypt on Debian and Install UFW on Debian so the board stays easier to maintain once real traffic starts hitting it.

Share this guide

Help another Linux user troubleshoot faster

Share this guide with someone troubleshooting Linux systems or saving it for later.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Verify before posting: