Skip to content

Deploying a PhpBB App

Introduction

PhpBB is an open-source forum platform built on PHP. Deploying PhpBB with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage for attachments, cache, and configuration—all configured from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample usage, and production tips.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your PhpBB code and Dockerfile (GitHub is the only supported git source)
  • A MySQL/MariaDB database (deploy as a Klutch.sh TCP app on port 8000 and connect on 3306)
  • Domain and TLS for secure access

For onboarding, see the Quick Start.


Architecture and ports

PhpBB runs on PHP/Apache; set the internal container port to 8080 and choose HTTP traffic.


Repository layout

phpbb/
├── Dockerfile # Must be at repo root for auto-detection
├── config.php # Generated/edited; keep secrets out of Git
├── cache/ # Cache (persist)
├── files/ # Uploaded files (persist)
└── store/ # Sessions and attachments (persist)

Keep secrets out of Git; store them in Klutch.sh environment variables.


Installation (local) and starter commands

Validate locally before pushing to GitHub:

Terminal window
docker build -t phpbb-local .
docker run -p 8080:8080 --env-file .env phpbb-local

Dockerfile for PhpBB (production-ready)

Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):

FROM php:8.1-apache
ENV APACHE_HTTP_PORT_NUMBER=8080
WORKDIR /var/www/html
RUN apt-get update && apt-get install -y --no-install-recommends \
libpng-dev libjpeg-dev libzip-dev libxml2-dev unzip git \
&& docker-php-ext-configure gd --with-jpeg \
&& docker-php-ext-install gd mysqli zip intl xmlrpc soap opcache \
&& a2enmod rewrite \
&& sed -i 's/80/${APACHE_HTTP_PORT_NUMBER}/g' /etc/apache2/ports.conf /etc/apache2/sites-available/000-default.conf \
&& rm -rf /var/lib/apt/lists/*
COPY . .
RUN mkdir -p cache files store && \
chown -R www-data:www-data /var/www/html
EXPOSE 8080
CMD ["apache2-foreground"]

Notes:

  • Add additional PHP extensions if your plugins require them.
  • Keep cache/, files/, and store/ writable; mount them as volumes.

Environment variables (Klutch.sh)

Set these in Klutch.sh before deploying:

  • APACHE_HTTP_PORT_NUMBER=8080
  • PHPBB_DB_HOST=<db-host>
  • PHPBB_DB_PORT=3306
  • PHPBB_DB_NAME=<db-name>
  • PHPBB_DB_USER=<db-user>
  • PHPBB_DB_PASSWORD=<db-password>
  • Optional SMTP: PHPBB_SMTP_HOST, PHPBB_SMTP_PORT, PHPBB_SMTP_USER, PHPBB_SMTP_PASSWORD, PHPBB_SMTP_AUTH, PHPBB_SMTP_METHOD

If you deploy without the Dockerfile and need Nixpacks overrides (PHP):

  • NIXPACKS_PHP_VERSION=8.1
  • NIXPACKS_START_CMD=apache2-foreground

Attach persistent volumes

In Klutch.sh storage settings, add mount paths and sizes (no names required):

  • /var/www/html/cache — cache.
  • /var/www/html/files — uploads.
  • /var/www/html/store — attachments and sessions.
  • Optionally /var/www/html/config.php if you keep it outside the image.

Ensure these paths are writable inside the container.


Deploy PhpBB on Klutch.sh (Dockerfile workflow)

  1. Push your repository—with the Dockerfile at the root—to GitHub.
  2. Open klutch.sh/app, create a project, and add an app.
  3. Select HTTP traffic and set the internal port to 8080.
  4. Add the environment variables above, including database and optional SMTP settings.
  5. Attach persistent volumes for /var/www/html/cache, /var/www/html/files, /var/www/html/store (and optionally /var/www/html/config.php) sized for your storage needs.
  6. Deploy. Complete the PhpBB web installer at https://example-app.klutch.sh and connect it to your database.

Sample usage

Check reachability:

Terminal window
curl -I https://example-app.klutch.sh

After installation, manage forums, users, and extensions via the PhpBB admin UI.


Health checks and production tips

  • Add an HTTP probe to / or a lightweight status page once configured.
  • Enforce HTTPS at the edge; forward internally to port 8080.
  • Keep DB and SMTP credentials in Klutch.sh secrets; rotate them regularly.
  • Monitor storage usage on files/, store/, and cache/; resize before they fill.
  • Pin image versions and test upgrades in staging; back up DB and volumes before updates.

PhpBB on Klutch.sh combines reproducible Docker builds with managed secrets, persistent storage, and flexible HTTP/TCP routing. With the Dockerfile at the repo root, port 8080 configured, and MySQL/MariaDB connected, you can run a secure forum without extra YAML or workflow overhead.