Log inSign up

Building a Flarum community forum

Flarum is installed with Composer rather than from a zip: run composer create-project flarum/flarum in an empty folder, point Nginx at its public directory and include the bundled .nginx.conf, then finish the web installer with your MariaDB details. After that, extensions and updates are Composer commands followed by php flarum migrate and php flarum cache:clear.

Topic: Websites, CMS and shops · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13 · Updated 2026-12-03

What does Flarum need?

Flarum is a modern PHP forum with a single-page front end, and it needs very little server power. A community of a few hundred active members runs on 1 to 2 GB of RAM. You need:

  • Ubuntu 24.04 or 22.04, Debian 12 or 13.
  • PHP-FPM with the curl, dom, fileinfo, gd, mbstring, openssl, pdo_mysql, tokenizer and zip extensions. Check the minimum PHP version of the Flarum release you install; current releases are happy on PHP 8.2 or newer.
  • MariaDB or MySQL.
  • Composer 2.
  • SSH access, because installs and updates run in the shell.

How do you install PHP, MariaDB, Nginx and Composer?

All four come from the distribution repositories. The Debian and Ubuntu Composer package is recent enough for Flarum; the Composer guide shows the official installer if you prefer the newest release.

sudo apt update
sudo apt install -y nginx mariadb-server php-fpm php-mysql php-curl php-gd \
  php-mbstring php-xml php-zip php-intl composer unzip git
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable
php -v
composer --version

The php-xml package provides dom, and fileinfo, openssl and tokenizer are compiled into the Debian and Ubuntu PHP builds. Confirm with php -m | grep -Ei 'dom|fileinfo|tokenizer'.

How do you create the database?

Give Flarum its own database and a user that can only reach it from localhost.

sudo mariadb-secure-installation
sudo mariadb <<'SQL'
CREATE DATABASE flarum CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'flarumuser'@'localhost' IDENTIFIED BY 'flarum-db-password';
GRANT ALL PRIVILEGES ON flarum.* TO 'flarumuser'@'localhost';
FLUSH PRIVILEGES;
SQL

Write the password down for the installer. If you plan to run other applications on the same server, the database users guide explains how to keep each one separated.

How do you install Flarum with Composer?

Run Composer as your normal user (never as root), then hand the writable folders to the web server group.

sudo mkdir -p /var/www/flarum
sudo chown deploy:www-data /var/www/flarum
cd /var/www/flarum
composer create-project flarum/flarum . --no-dev
sudo chgrp -R www-data storage public/assets
sudo chmod -R g+rwX storage public/assets
sudo find storage public/assets -type d -exec chmod g+s {} +
ls public

The public folder is what visitors see; everything else, including vendor and config.php, stays outside the web root. The setgid bit keeps new cache and upload files in the www-data group so both you and PHP can manage them.

How do you configure Nginx for Flarum?

Point the root at public and include the rules file Flarum ships in the project folder. Create /etc/nginx/sites-available/community.example.net:

server {
    listen 80;
    listen [::]:80;
    server_name community.example.net;
    root /var/www/flarum/public;
    index index.php;
    client_max_body_size 16m;

    include /var/www/flarum/.nginx.conf;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    }
}
sudo ln -s /etc/nginx/sites-available/community.example.net /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d community.example.net

The included file sends every unknown path to index.php, blocks hidden files and sets cache headers for assets. Change the socket to php8.2-fpm.sock on Debian 12 or php8.4-fpm.sock on Debian 13.

How do you finish the installation?

Open https://community.example.net and fill in the installer: forum title, MariaDB host localhost, database flarum, user flarumuser and its password, and the first admin account. Leave the table prefix empty unless the database is shared. When the forum loads, check the install from the shell:

cd /var/www/flarum
php flarum info
curl -I https://community.example.net

php flarum info prints the Flarum and PHP versions, enabled extensions and the base URL, which is the first thing to share when asking for help. Make sure the URL begins with https; if not, correct url in config.php.

How do you set up email and the scheduler?

Email confirms accounts and delivers notifications, so configure it before opening sign-ups. In the admin panel, open Email, choose the SMTP driver, and enter your relay host, port 587, encryption tls, username and password, then send the test email. Port 25 is not a dependable path for outgoing mail; a support ticket is the right way to ask about it, and the SMTP relay guide covers the reliable route.

Some extensions and core cleanup tasks run on Flarum's scheduler, which needs a cron entry:

sudo crontab -u www-data -e
# add:
* * * * * cd /var/www/flarum && php flarum schedule:run >> /dev/null 2>&1

Check it with sudo -u www-data php /var/www/flarum/flarum schedule:list.

How do you add extensions and update Flarum?

Extensions are Composer packages. Require the package, run migrations, clear the cache, then enable it in the admin panel.

cd /var/www/flarum
composer require vendor/extension-name
php flarum migrate
php flarum cache:clear

For updates, back up the database and folder first, then update every package together:

sudo mariadb-dump --single-transaction flarum | gzip > ~/flarum-$(date +%F).sql.gz
tar -czf ~/flarum-files-$(date +%F).tar.gz -C /var/www flarum
composer update --prefer-dist --no-dev -a --with-all-dependencies
php flarum migrate
php flarum cache:clear

Major Flarum versions can break extensions that have not been updated yet. Before a major upgrade, check that every extension you rely on lists support for the new version, and test on a copy of the forum. Keep off-server copies of the backups as described in the daily backups tutorial.

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
A1-2a new community1 vCPU, 2 GB RAM, 50 GB NVMe$7.20/mo$43.20 for 6 months
A2-4active forums with many extensions2 vCPU, 4 GB RAM, 100 GB NVMe$14.40/mo$43.20 for 3 months

Questions about Flarum forum

Why does Flarum show a blank page after an update?

Usually the cache or assets were not rebuilt. Run php flarum cache:clear, check that storage and public/assets are writable by www-data, and read storage/logs for the error.

Can I install Flarum without Composer?

Composer is the supported method. It also handles extensions and updates, so it is worth learning even for a small forum.

Should I run Composer as root?

No. Run it as your normal user who owns the folder; only the storage and public/assets folders need write access for the web server.

Does Flarum support PostgreSQL?

Flarum 1.x uses MySQL or MariaDB. Newer major versions add more database options; check the requirements of the release you install.

How do I move Flarum to a new domain?

Update url in config.php, request a certificate for the new name, update the Nginx server_name and clear the cache.