phpbb

How to Install phpBB on a VPS with Docker

Online communities never really went away. While social platforms grab the headlines, forums quietly keep humming along as the place where people actually go deep on a topic, swap real expertise and build lasting relationships. phpBB has been at the heart of that world for over two decades, and it’s still one of the most trusted ways to run a forum you actually own.

Run phpBB on your own VPS and you control everything: your data, your members, your rules and your costs. Wrap it in Docker and the setup gets dramatically cleaner. Containers keep phpBB, PHP and the database neatly boxed up, so your host machine stays tidy and upgrades stop being scary. By the end of this guide you’ll have phpBB running in Docker, sitting behind an Nginx reverse proxy, locked down with a free Let’s Encrypt certificate and ready for your first members.

What is phpBB?

phpBB is a free, open-source forum software package written in PHP. The name is short for “PHP Bulletin Board,” and the project has been going strong since 2000. It’s released under the GNU General Public License, which means it’s genuinely free to use, modify and self-host without licensing fees hanging over your head.

What keeps phpBB popular after all these years is a mix of maturity and flexibility. You get threaded discussions, private messaging, user groups and granular permissions right out of the box. A huge ecosystem of extensions and styles lets you reshape the look and bolt on new features without touching core code. Because it runs on the familiar PHP and MySQL stack, it feels right at home on almost any VPS. Hobby communities, support forums and large enthusiast boards all lean on it every single day.

Why run phpBB in Docker?

You can install phpBB the old-fashioned way by dropping files onto a LAMP server and clicking through the web installer. Docker just makes the whole thing calmer and more repeatable.

With Docker, every piece of your stack lives in its own container. phpBB and its PHP runtime sit in one place, MySQL sits in another and they talk over a private network you define. Nothing leaks onto the host, so you avoid the classic mess of conflicting PHP versions and stray config files. Spinning the whole thing up, tearing it down or moving it to a new server becomes a matter of a few commands. Your data stays safe in named volumes, and rebuilding a container never touches it.

There’s a small wrinkle worth knowing up front. phpBB doesn’t publish an official Docker image, so the community-maintained image from Bitnami has long been the go-to choice. It’s well packaged, sensibly configured and saves you from hand-rolling your own Dockerfile. We’ll use it here, and you’ll pin a specific version so surprise updates never break your board overnight.

Prerequisites

phpBB is light on resources, so you don’t need a beefy server to run a healthy community. Here’s what to aim for depending on how much traffic you expect.

RequirementMinimumRecommended
CPU1 vCPU2 vCPU
RAM1 GB2 GB or more
Storage10 GB SSD25 GB SSD or more
Operating systemUbuntu 22.04 LTSUbuntu 24.04 LTS
SoftwareDocker Engine, Docker ComposeDocker Engine, Docker Compose

Beyond the server itself, you’ll want a few things lined up before you start. You need a registered domain name, along with an A record pointing it at your VPS public IP address. You’ll also need a non-root user with sudo privileges, and SSH access to the server. Finally, make sure ports 80 and 443 are open in your firewall so web traffic and SSL validation can get through.

Step 1: Prepare your server

Start by logging into your VPS over SSH as your sudo user. Before installing anything new, refresh the package lists and upgrade what’s already there. This keeps your base system patched and avoids dependency headaches later.

sudo apt update && sudo apt upgrade -y

If the upgrade pulls in a new kernel, reboot the server so the changes take effect. Give it a moment and reconnect over SSH once it’s back.

sudo reboot

Step 2: Install Docker Engine

Next, install Docker straight from its official repository. The version in Ubuntu’s default repos tends to lag behind, so pulling from Docker’s own source gets you the latest stable release plus the Compose plugin you’ll need shortly.

Add Docker’s official repository

First, install the handful of packages that let apt fetch software over HTTPS, then add Docker’s GPG key so your system trusts the packages it downloads.

sudo apt install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

Now add the Docker repository to your apt sources. This one-liner detects your Ubuntu version automatically, so it works whether you’re on 22.04 or 24.04.

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install the Docker packages

Refresh your package lists so apt picks up the new repository, then install Docker Engine, the command-line tools and the Compose plugin in one go.

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Confirm everything landed correctly by checking the versions. If both commands return version numbers, you’re in good shape.

docker --version
docker compose version

By default, Docker commands need sudo. To run them as your regular user, add yourself to the docker group. Log out and back in afterward so the new membership takes effect.

sudo usermod -aG docker ${USER}

Step 3: Create your project folder and environment file

Keeping everything in one tidy directory makes your setup easy to reason about and easy to back up. Create a folder for phpBB and move into it.

mkdir -p ~/phpbb
cd ~/phpbb

Rather than hard-coding passwords into your Compose file, you’ll store them in a separate .env file. This keeps secrets out of your main config and makes them simple to change. Open a new file with nano.

nano .env

Paste in the following, swapping the placeholder values for your own strong passwords and your real domain. Use long, random strings for both password fields.

MYSQL_ROOT_PASSWORD=change_this_root_password
PHPBB_DATABASE_NAME=phpbb_db
PHPBB_DATABASE_USER=phpbb_user
PHPBB_DATABASE_PASSWORD=change_this_db_password
PHPBB_HOST=forum.yourdomain.com

Save and close the file by pressing Ctrl+O, then Enter, then Ctrl+X. Because this file holds your credentials, lock down its permissions so only your user can read it.

chmod 600 .env

Step 4: Create the Docker Compose file

This is where the magic happens. Your Compose file describes both containers, how they connect and where their data lives. Create it now.

nano docker-compose.yml

Paste in the configuration below. Take a second to read the comments, since they explain the choices that keep this setup secure and stable.

services:
  mariadb:
    image: docker.io/bitnami/mariadb:11.4
    restart: unless-stopped
    environment:
      - MARIADB_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MARIADB_DATABASE=${PHPBB_DATABASE_NAME}
      - MARIADB_USER=${PHPBB_DATABASE_USER}
      - MARIADB_PASSWORD=${PHPBB_DATABASE_PASSWORD}
    volumes:
      - mariadb_data:/bitnami/mariadb
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      interval: 15s
      timeout: 5s
      retries: 10

  phpbb:
    image: docker.io/bitnami/phpbb:3.3
    restart: unless-stopped
    # Bind to localhost only so Nginx handles all public traffic
    ports:
      - "127.0.0.1:8080:8080"
    environment:
      - PHPBB_DATABASE_HOST=mariadb
      - PHPBB_DATABASE_PORT_NUMBER=3306
      - PHPBB_DATABASE_NAME=${PHPBB_DATABASE_NAME}
      - PHPBB_DATABASE_USER=${PHPBB_DATABASE_USER}
      - PHPBB_DATABASE_PASSWORD=${PHPBB_DATABASE_PASSWORD}
      - PHPBB_HOST=${PHPBB_HOST}
    volumes:
      - phpbb_data:/bitnami/phpbb
    depends_on:
      mariadb:
        # Wait for the database to be genuinely ready, not just started
        condition: service_healthy

volumes:
  mariadb_data:
  phpbb_data:

A couple of decisions here are worth calling out. The phpBB port is bound to 127.0.0.1 rather than 0.0.0.0, which means the container is only reachable from the server itself. Nginx will front all public traffic, so your app never sits directly exposed to the internet. The depends_on block uses a healthcheck condition, so phpBB waits until MariaDB is truly ready to accept connections. That single detail prevents the frustrating first-boot race where the app starts before the database and promptly falls over.

Step 5: Launch the containers

With your Compose file ready, bring the whole stack to life. The -d flag runs everything in the background so you get your terminal back.

docker compose up -d

Docker now pulls the images and starts your containers. The first launch takes a little while, since phpBB has to initialize its database and set up its files. Watch the logs to follow along.

docker compose logs -f phpbb

Once you see log lines showing that phpBB is ready and listening, the setup has finished. Press Ctrl+C to stop following the logs. Your containers keep running happily in the background. You can confirm their status at any time.

docker compose ps

Step 6: Configure Nginx as a reverse proxy

Your forum is running, but only your server can reach it right now. Nginx bridges that gap by accepting public requests on ports 80 and 443 and quietly forwarding them to phpBB on its local port. Install Nginx first.

sudo apt install -y nginx

Create a new server block for your domain.

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

Paste in the configuration below, and remember to replace forum.yourdomain.com with your actual domain in both spots.

server {
    listen 80;
    listen [::]:80;
    server_name forum.yourdomain.com;

    # Allow larger avatar and attachment uploads
    client_max_body_size 20M;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Enable the site by linking it into the enabled-sites folder, then test your configuration for syntax errors before reloading.

sudo ln -s /etc/nginx/sites-available/phpbb /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

Open your domain in a browser now and you should see phpBB answering over plain HTTP. Don’t stop here though. The next step locks it down with encryption.

Step 7: Secure your forum with SSL

Running a forum over plain HTTP means passwords and private messages travel in the clear. A free Let’s Encrypt certificate fixes that in minutes. Certbot handles both the certificate and the Nginx changes for you. Install it through snap, which is the method the Certbot team recommends.

sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot

Now ask Certbot to fetch a certificate for your domain and wire it into Nginx automatically. Swap in your real domain and a valid email address.

sudo certbot --nginx -d forum.yourdomain.com

Certbot walks you through a few quick prompts. When it asks, choose to redirect all HTTP traffic to HTTPS so visitors always land on the secure version. Once it finishes, revisit your domain and you’ll see the padlock in your browser bar.

Certificates from Let’s Encrypt last 90 days, but Certbot sets up automatic renewal so you never have to think about it. Confirm the renewal timer works with a dry run.

sudo certbot renew --dry-run

Step 8: Complete the phpBB setup

Head to your domain over HTTPS and phpBB greets you with its setup wizard. The Bitnami image has already handled the database connection behind the scenes, so this part is refreshingly quick.

Create your administrator account with a username, a strong password and your email address. Give your board a name and a short description, since these show up across the forum and in search results. Once you submit, phpBB finalizes everything and drops you at your brand-new forum. Log in with the admin account you just created and you’re live.

Your first stop should be the Administration Control Panel, reachable from the link at the bottom of any page. From there you can create forum categories, set up user groups, tune permissions and install a fresh style. Take your time exploring, because this is where you shape the community you want to build.

How to update phpBB

Keeping phpBB current matters for both security and features. Because you pinned image versions in your Compose file, updates happen on your schedule instead of catching you off guard. Always back up before you touch anything.

First, dump your database to a timestamped file. Run this from inside your project folder.

docker compose exec mariadb sh -c 'exec mariadb-dump -uroot -p"$MARIADB_ROOT_PASSWORD" '"$PHPBB_DATABASE_NAME"'' > phpbb_backup_$(date +%F).sql

With a backup safely in hand, edit your docker-compose.yml and bump the phpBB image tag to the version you want. Check the Bitnami phpBB page on Docker Hub to see what’s current before you change it. Then pull the new image and recreate the containers.

docker compose pull
docker compose up -d

Docker swaps in the updated container while leaving your named volumes untouched, so your posts, members and settings all survive. If phpBB itself needs to run a database migration, it prompts you inside the Administration Control Panel the next time you log in. Follow those on-screen steps to finish the upgrade.

Troubleshooting common issues

Even a smooth setup hits the occasional snag. Here are the problems people run into most, along with how to sort them out.

The phpBB container keeps restarting

A container stuck in a restart loop almost always points to a database problem. Check the logs to see what’s actually failing.

docker compose logs phpbb

Look for errors about connecting to the database or bad credentials. The usual culprit is a mismatch between the passwords in your .env file and what the database container initialized with. If you changed a password after the first launch, the old one is baked into the volume. Fixing it cleanly means removing the volumes and starting fresh, which erases data, so only do this on a new install.

docker compose down -v
docker compose up -d

You see a 502 Bad Gateway error

A 502 means Nginx can’t reach the phpBB container. First, confirm phpBB is actually running and healthy.

docker compose ps

If the container is up, double-check that the proxy_pass port in your Nginx config matches the localhost port in your Compose file. Both should point at 8080. A simple typo here is the most common cause. After any change, test and reload Nginx.

sudo nginx -t && sudo systemctl reload nginx

Certbot fails to issue a certificate

When Certbot can’t validate your domain, the cause is nearly always DNS or firewall related. Make sure your domain’s A record points at your VPS IP address and has had time to propagate. Confirm that ports 80 and 443 are open, since Let’s Encrypt needs to reach your server to verify ownership. If you’re behind a cloud firewall as well as a local one, check both. Once DNS and ports look right, run the Certbot command again.

Uploads and avatars fail with a size error

If members can’t upload attachments or avatars, two limits might be capping them. The first is Nginx, which you already raised with the client_max_body_size directive. If you skipped that line, add it back inside your server block and reload Nginx. The second limit lives inside phpBB itself, under the Administration Control Panel in the attachment settings. Raise the maximum file size there to match, and your uploads sail through.

Images and links point to the wrong address

Sometimes phpBB generates links using http or the wrong hostname, which breaks styling or redirects. This happens when the server settings inside phpBB don’t match how visitors actually reach the site. Log into the Administration Control Panel, open the general server settings and confirm the domain name, server protocol and port all reflect your real HTTPS address. Set the protocol to https:// and the port to 443, then save. Clear your board cache from the same panel and the links straighten themselves out.

What to do next

You’ve got a secure, containerized phpBB forum running on your own VPS. That’s a solid foundation, so now comes the fun part of turning it into a real community.

Start by making the place your own. Browse the official phpBB styles database and pick a look that suits your topic, then install it through the Administration Control Panel. Explore the extensions database too, where you’ll find everything from spam protection to social login to advanced media embedding. A well-chosen anti-spam extension is worth setting up early, before the bots find you.

On the operations side, get a proper backup routine going. The manual dump command from the update section works well as a starting point, and you can drop it into a cron job so backups run automatically. Copy those backups somewhere off the server for real peace of mind. It’s also worth setting up your outgoing email so registration and notification messages actually reach your members, which you can configure under the email settings in the control panel.

Most of all, spend time on the human side. Write a welcoming set of forum rules, seed a few interesting discussions and reply to your earliest members personally. Software runs a forum, but people make it worth visiting. With phpBB humming along quietly in the background, you’re free to focus on exactly that.