Flarum on VPS is a modern forum platform that can be installed and configured on a Virtual Private Server (VPS) for complete control over performance, security, and scalability, providing a flexible and efficient solution for your community.
What is Flarum and why choose a VPS for its deployment?
Flarum is an elegant, fast, and modern forum engine, designed from the ground up for ease of use and extensibility. It is written in PHP using the Laravel framework and React for the frontend, ensuring a dynamic and responsive user interface. Flarum features a minimalist design, intuitive management, and a powerful plugin system, allowing functionality to be adapted to any needs. Unlike the heavyweight solutions of the past, Flarum aims to be lightweight and fast, offering a modern approach to building online communities.
Advantages of Flarum for the community
Choosing Flarum for your online community offers several significant advantages:
- Modern Interface: Flarum offers a clean, responsive, and intuitive design that looks great on any device. This increases user engagement and simplifies forum navigation.
- High Performance: Optimized architecture and the use of modern technologies ensure fast page loading and smooth interaction, which is critical for user retention.
- Ease of Use: For both administrators and regular users, Flarum is extremely easy to learn. Content management, moderation, and participation in discussions are straightforward.
- Extensibility: Thanks to its powerful plugin system, Flarum is easily extensible. You can add new features, integrate third-party services, and customize the forum to meet your community's specific requirements.
- Active Development: The Flarum project is actively developed by the community, with regular updates, bug fixes, and new features being released.
Why Flarum self-hosted on a VPS is the optimal choice?
While cloud platforms for forum hosting exist, Flarum self-hosted on a VPS offers an unparalleled level of control and flexibility. Hosting Flarum on your own Virtual Private Server from Valebyte.com allows for:
- Full Control: You have complete control over the server environment, installed software, security settings, and data. This is critical for projects with high privacy and customization requirements.
- Scalability: As your community grows, you can easily scale VPS resources (CPU, RAM, storage) without needing to migrate to another platform. This ensures smooth growth and stable operation under any load.
- Performance Optimization: You can fine-tune the server environment (web server, PHP, database) for maximum Flarum performance, based on your specific traffic and usage patterns.
- Cost-Effectiveness: In the long run, hosting on a VPS often proves more cost-effective than subscriptions to specialized cloud platforms, especially as your audience grows.
- Security: You manage security measures independently, installing firewalls, intrusion detection systems, and regularly updating software, ensuring a high level of data protection.
- Integration: On a VPS, it's easier to integrate Flarum with your other services or applications, whether it's a single sign-on (SSO) system, analytics, or custom tools.
Using Docker for Flarum deployment on a VPS further simplifies the process, isolating the application and its dependencies, which enhances stability and eases management.
System Requirements for Flarum on a Server
Before proceeding with Flarum installation on a server, it's important to ensure that your VPS meets the minimum system requirements. Flarum, as a modern PHP application, has specific dependencies that must be satisfied for its correct operation.
Minimum and Recommended VPS Specifications
The choice of VPS configuration depends on the expected load and the number of active users. For starting with a small community, minimum requirements will suffice, but a growing or already active forum will require a more powerful server.
Minimum Requirements for Flarum (up to 50-100 active users):
- Processor (CPU): 1 vCPU with 2.0+ GHz frequency.
- Random Access Memory (RAM): 1 GB. This is sufficient for PHP-FPM, database, and web server operation under low load.
- Disk Space: 10-20 GB NVMe SSD. NVMe significantly speeds up I/O operations, which is important for the database and caching.
- Bandwidth: 500 GB - 1 TB/month.
- Operating System: Ubuntu 22.04 LTS, Debian 11/12, or CentOS 8/Stream.
Recommended Requirements for Flarum (100-500 active users):
- Processor (CPU): 2 vCPU with 2.5+ GHz frequency.
- Random Access Memory (RAM): 2-4 GB. Allows better data caching and handling of more simultaneous requests.
- Disk Space: 50 GB NVMe SSD. Provides sufficient volume for data, logs, and potential growth.
- Bandwidth: 2-4 TB/month.
- Operating System: Ubuntu 22.04 LTS, Debian 12.
For very large communities with thousands of active users, more powerful configurations will be required, possibly with separate servers for the database and web server, as well as load balancing. However, for most cases, a mid-range VPS will be sufficient.
Required Software
For successful Flarum installation on a VPS, in addition to the operating system, you will need the following software. Using Docker significantly simplifies the management of these dependencies.
- Docker Engine: The main component for running containers.
- Docker Compose: A tool for defining and running multi-container Docker applications.
- Web Server: Nginx or Apache (Flarum requires PHP-FPM, which will interact with the web server). In our article, we will use Nginx as a reverse proxy for the Docker container.
- Database: MySQL 5.6+ / MariaDB 10.0.5+. Flarum stores all its data in a relational database.
- PHP: PHP 8.1+ with extensions:
php-fpm(for Nginx)php-mysqlphp-jsonphp-gdphp-domphp-mbstringphp-tokenizerphp-zipphp-xmlphp-bcmathphp-gmp
When using Docker, all these PHP extensions are already included in the official Flarum image.
- Composer: PHP dependency manager (although when using Docker, it is often not required for the end-user, as it is used inside the container).
- Git: For cloning repositories (useful, but not strictly necessary for Docker installation).
In this article, we will focus on installing Flarum using Docker and Docker Compose, which greatly simplifies the management of all these dependencies, as they will be encapsulated in containers.
Looking for a reliable server for your projects?
VPS from $10/month and dedicated servers from $9/month with NVMe, DDoS protection, and 24/7 support.
View offers →Preparing Your VPS for Flarum Docker Installation: Basic Steps
Before proceeding with Flarum installation, you need to prepare your VPS. These steps are standard for most Linux servers and provide a secure and stable foundation for your application.
System Update and Docker Engine Installation
First, connect to your VPS via SSH as the root user or with sudo privileges. It is recommended to use a user with sudo privileges for daily work, but for Docker installation, it is often more convenient to temporarily use root.
Update the package list and installed packages to their latest versions:
sudo apt update && sudo apt upgrade -y
Install the necessary packages for Docker:
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
Add Docker's official GPG key:
sudo mkdir -p /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
Add the Docker repository to APT sources:
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
Again, update the package list and install Docker Engine, Docker CLI, and Containerd:
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Verify Docker installation and operation:
sudo docker run hello-world
You should see the message "Hello from Docker!".
Add the current user to the docker group to avoid using sudo every time you work with Docker. Replace your_username with your username:
sudo usermod -aG docker your_username
newgrp docker # Restart your session or run this command to apply changes
Now install Docker Compose (if it wasn't installed as a plugin):
sudo apt install -y docker-compose
Check the Docker Compose version:
docker compose version
Firewall Configuration and User Creation
To enhance your VPS security, configure a firewall (UFW - Uncomplicated Firewall) to allow only necessary ports.
Allow SSH (port 22), HTTP (port 80), and HTTPS (port 443):
sudo ufw allow OpenSSH
sudo ufw allow http
sudo ufw allow https
sudo ufw enable
Confirm firewall activation by typing y.
Check the firewall status:
sudo ufw status
You should see the allowed ports.
Although you can work as root, for security and convenience, it is recommended to create a separate user with limited privileges and use sudo for administrative tasks. If you are already working under such a user, skip this step.
sudo adduser flarumuser
sudo usermod -aG sudo flarumuser
sudo usermod -aG docker flarumuser # Add user to the docker group
Now you can exit root and log in as the new user flarumuser.
exit
Then log in again via SSH:
ssh flarumuser@your_vps_ip
After logging in, you will be working as flarumuser. Execute all commands requiring root privileges with sudo.
Need a dedicated server?
Compare prices from top providers. Configure and order in minutes.
Step-by-Step Flarum Installation on VPS using Docker Compose
Using Docker Compose is the most recommended way to install Flarum on a VPS. It allows you to define all services (Flarum, Nginx, MariaDB) and their dependencies in a single file, simplifying deployment and management.
Creating the docker-compose.yml file for Flarum
Create a directory for your Flarum project and navigate into it:
mkdir flarum_forum
cd flarum_forum
Create the docker-compose.yml file:
nano docker-compose.yml
Paste the following content. This file defines three services: flarum (the application itself), db (MariaDB database), and nginx (web server/reverse proxy).
version: '3.8'
services:
flarum:
image: flarum/flarum:1.8.0 # Use the actual Flarum version
container_name: flarum_app
restart: always
volumes:
- ./app:/app
environment:
- DB_HOST=db
- DB_DATABASE=flarum
- DB_USERNAME=flarum
- DB_PASSWORD=your_db_password # Replace with a strong password
- APP_URL=http://localhost:8000 # Temporary, will be changed to domain
- PHP_MEMORY_LIMIT=256M # Recommended to increase if needed
depends_on:
- db
db:
image: mariadb:10.6
container_name: flarum_db
restart: always
environment:
- MYSQL_ROOT_PASSWORD=your_root_db_password # Replace with a strong password
- MYSQL_DATABASE=flarum
- MYSQL_USER=flarum
- MYSQL_PASSWORD=your_db_password # Must match Flarum password
volumes:
- ./db_data:/var/lib/mysql
nginx:
image: nginx:stable-alpine
container_name: flarum_nginx
restart: always
ports:
- "80:80" # Open port 80
# - "443:443" # Will be activated after HTTPS setup
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- ./app:/var/www/flarum # Flarum assets for Nginx
depends_on:
- flarum
volumes:
db_data:
app:
Important notes:
- Replace
your_db_passwordandyour_root_db_passwordwith strong, unique passwords. image: flarum/flarum:1.8.0– make sure you are using the actual Flarum version. You can check on Docker Hub.APP_URL=http://localhost:8000– this is a temporary URL. We will change it after setting up the domain and HTTPS.PHP_MEMORY_LIMIT=256M– sufficient for small forums, but with active plugin use or a large number of users, 512M or 1G may be required.
Now, create the Nginx configuration file nginx.conf in the same flarum_forum directory:
nano nginx.conf
Paste the following content:
server {
listen 80;
server_name your_domain.com www.your_domain.com; # Replace with your domain
root /var/www/flarum/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass flarum:9000; # Flarum service name and PHP-FPM port
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
Important note: Replace your_domain.com www.your_domain.com with your actual domain. If you don't have a domain, you can use your VPS IP address for now, but for full functionality and HTTPS, a domain is necessary.
Starting Containers and Initial Flarum Setup
After creating the docker-compose.yml and nginx.conf files, you are ready to launch Flarum. Make sure you are in the flarum_forum directory.
Start all Docker Compose services in the background:
docker compose up -d
This command will create and start the flarum_app, flarum_db, and flarum_nginx containers. The process may take some time as Docker will download the images.
Check the status of the running containers:
docker compose ps
You should see all three containers in "Up" status.
Now you need to perform the initial Flarum installation inside the container. This is done using the php flarum install command. You will need the data you specified in docker-compose.yml:
- Database Host:
db(database service name) - Database Name:
flarum - Database Username:
flarum - Database Password:
your_db_password - Table Prefix: (can be left empty)
- Admin Username: (choose a name for the administrator)
- Admin Email: (provide administrator email)
- Admin Password: (choose a strong password for the administrator)
- Base URL:
http://your_domain.com(or your VPS IP, without HTTPS for now)
Execute the installation command. Replace placeholders with your values:
docker compose exec flarum php flarum install \
--database_host=db \
--database_name=flarum \
--database_user=flarum \
--database_pass=your_db_password \
--url=http://your_domain.com \
--admin_user=admin_username \
--admin_pass=admin_password \
[email protected]
After successful execution of this command, Flarum will be installed and initialized with a basic configuration.
Now you can open your browser and navigate to http://your_domain.com (or your VPS IP). You should see the installed Flarum. Log in to the administrator panel using the credentials you provided during installation.
At this stage, Flarum is running on HTTP. The next step is to configure HTTPS for security.
Configuring Reverse Proxy and HTTPS for Flarum on the Server
To ensure user security and trust, as well as to comply with modern web development standards, it is crucial to configure HTTPS for your Flarum forum. We will look at two popular reverse proxy options: Nginx (with manual Let's Encrypt setup) and Caddy (with automatic HTTPS).
Integrating Nginx as a Reverse Proxy with Let's Encrypt
If you are using Nginx as a reverse proxy, as was the case in our docker-compose.yml, you will need to configure Let's Encrypt to obtain and automatically renew SSL certificates.
1. Installing Certbot
Certbot is a tool from the Electronic Frontier Foundation (EFF) that simplifies obtaining and installing Let's Encrypt SSL certificates.
sudo apt install -y certbot python3-certbot-nginx
2. Nginx Configuration for Certbot
We need Nginx to listen on port 80 and be accessible to Certbot for domain verification. The nginx.conf file we created already has port 80 listening. Make sure server_name matches your domain.
If you want Nginx to handle HTTPS, you will need to modify docker-compose.yml so that Nginx listens on port 443 and redirects requests to Flarum. However, a cleaner approach is to use Nginx only as a reverse proxy for internal HTTP traffic from Flarum, and perform SSL termination on an external Nginx that is not in a Docker container. This is more complex but gives more control.
For simplicity, we will use Nginx inside the Docker container to handle HTTPS. To do this, we need to modify our nginx.conf and docker-compose.yml.
Update docker-compose.yml:
Comment out the line - "80:80" and uncomment - "443:443", and also add port 80 for the Certbot challenge.
services:
nginx:
# ...
ports:
- "80:80" # For Certbot challenge and redirection to HTTPS
- "443:443" # For HTTPS traffic
# ...
Restart Docker Compose:
docker compose down
docker compose up -d
Update nginx.conf:
You will need to add configuration for HTTPS and HTTP to HTTPS redirection. Certbot will do this automatically for you, but first, you need to generate the certificate.
Temporarily remove the location ~ \.php$, location ~ /\.ht, and location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ sections from nginx.conf for the first Certbot run, so it can create a temporary file for domain verification. After obtaining the certificate, we will restore them.
Temporarily, your nginx.conf might look like this:
server {
listen 80;
server_name your_domain.com www.your_domain.com; # Replace with your domain
location / {
proxy_pass http://flarum:8000; # Direct to Flarum
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;
}
}
Restart the Nginx container to apply changes:
docker compose restart nginx
3. Obtaining an SSL Certificate with Certbot
Execute the Certbot command. Replace your_domain.com with your domain and [email protected] with your email address:
sudo certbot --nginx -d your_domain.com -d www.your_domain.com --email [email protected] --agree-tos --no-eff-email
Certbot will automatically modify your nginx.conf, adding sections for HTTPS and HTTP to HTTPS redirection.
4. Final Nginx Configuration
After Certbot adds the HTTPS configuration, your nginx.conf will contain two server sections: one for HTTP (redirecting to HTTPS) and one for HTTPS. You will need to modify the HTTPS section to correctly proxy requests to the Flarum container.
Example of the final nginx.conf (the part related to HTTPS):
server {
listen 443 ssl http2;
server_name your_domain.com www.your_domain.com;
ssl_certificate /etc/letsencrypt/live/your_domain.com/fullchain.pem; # Path to certificate
ssl_certificate_key /etc/letsencrypt/live/your_domain.com/privkey.pem; # Path to private key
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
root /var/www/flarum/public; # Path to Flarum public directory
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass flarum:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
}
location ~ /\.ht {
deny all;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
# Added by Certbot for HTTP to HTTPS redirection
server {
listen 80;
server_name your_domain.com www.your_domain.com;
return 301 https://$host$request_uri;
}
Important: Certbot by default places certificates in /etc/letsencrypt/live/your_domain.com/. For the Nginx container to access them, you need to either mount this directory into the container or copy the certificates. Mounting is the simplest way.
Update docker-compose.yml again to mount certificates:
services:
nginx:
# ...
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- ./app:/var/www/flarum
- /etc/letsencrypt:/etc/letsencrypt # Mount the certificates directory
Restart Docker Compose:
docker compose down
docker compose up -d
Your Flarum should now be accessible via HTTPS. Don't forget to update the APP_URL in your docker-compose.yml file and in Flarum settings (if applicable) to https://your_domain.com.
For automatic certificate renewal, Certbot will create a cron job. You can check it with the command sudo systemctl status certbot.timer.
Using Caddy for Automatic HTTPS
Caddy is a powerful web server that automatically obtains and renews Let's Encrypt SSL certificates by default. This significantly simplifies HTTPS setup.
1. Modifying docker-compose.yml
Remove the nginx service from docker-compose.yml and add the caddy service:
version: '3.8'
services:
flarum:
image: flarum/flarum:1.8.0
container_name: flarum_app
restart: always
volumes:
- ./app:/app
environment:
- DB_HOST=db
- DB_DATABASE=flarum
- DB_USERNAME=flarum
- DB_PASSWORD=your_db_password
- APP_URL=https://your_domain.com # Immediately specify HTTPS
- PHP_MEMORY_LIMIT=256M
depends_on:
- db
db:
image: mariadb:10.6
container_name: flarum_db
restart: always
environment:
- MYSQL_ROOT_PASSWORD=your_root_db_password
- MYSQL_DATABASE=flarum
- MYSQL_USER=flarum
- MYSQL_PASSWORD=your_db_password
volumes:
- ./db_data:/var/lib/mysql
caddy:
image: caddy:latest
container_name: flarum_caddy
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./site:/srv # For static files, if needed
- caddy_data:/data # For storing Caddy certificates
environment:
- CADDY_DOMAIN=your_domain.com # Pass domain to Caddyfile
depends_on:
- flarum
volumes:
db_data:
app:
caddy_data: # Declare volume for Caddy data
Important note: Update your_db_password, your_root_db_password, and your_domain.com. Make sure APP_URL in the Flarum service now points to https://your_domain.com.
2. Creating the Caddyfile
Create a Caddyfile in the same flarum_forum directory:
nano Caddyfile
Paste the following content:
{env.CADDY_DOMAIN} {
root * /srv/public # If Flarum will be located in /srv/public
php_fastcgi flarum:9000 {
root /app/public # Path to Flarum public directory inside the flarum container
}
file_server
# Additional settings for Flarum
rewrite /api(.*) /api$1
rewrite /flarum(.*) /flarum$1
rewrite /assets(.*) /assets$1
rewrite /vendor(.*) /vendor$1
# Protection against access to sensitive files
@forbidden {
path /.git/*
path /.env
path /composer.*
path /storage/*
path /vendor/*
}
respond @forbidden 403
# Logging (optional)
log {
output stdout
format json
}
}
Important note: php_fastcgi flarum:9000 { root /app/public } tells Caddy where to find Flarum's public directory inside the flarum container. {env.CADDY_DOMAIN} will be replaced with your domain from the Docker Compose environment variable.
3. Running Flarum with Caddy
Make sure you are in the flarum_forum directory. Bring down the old containers and start the new ones:
docker compose down
docker compose up -d
Caddy will automatically detect your domain, obtain an SSL certificate from Let's Encrypt, and configure HTTPS. This may take a few minutes on the first launch.
Check the container status:
docker compose ps
Then open your domain in a browser with https://. Your Flarum should now be running over a secure protocol.
Caddy automatically renews certificates, so you don't need to worry about manual renewal.
Flarum Maintenance: Backups, Updates, and Monitoring
Regular maintenance of Flarum on a VPS is critically important to ensure its stability, security, and relevance. This includes creating backups, timely updates, and performance monitoring.
Flarum Backup Strategies on VPS
Backups are your insurance against data loss. For Flarum, two main components need to be backed up: the database and application files.
1. Database Backup
The MariaDB database contains all posts, users, settings, and other important information. You can create a database dump using mysqldump from within the database container.
docker compose exec db sh -c "exec mariadb-dump -u flarum -pyour_db_password flarum > /tmp/flarum_db_backup.sql"
This command will create a database dump inside the db container. Now you need to copy it to the host system:
docker cp flarum_db:/tmp/flarum_db_backup.sql ./backups/flarum_db_backup_$(date +%F_%H-%M-%S).sql
Don't forget to create the ./backups directory beforehand.
To automate this process, you can create a cron job that will execute these commands regularly.
2. Application File Backup
Flarum application files include the Flarum core, plugins, uploaded files (avatars, attachments), and configuration files. Since we mount the ./app directory from the host into the Flarum container, backing up this directory on the host is sufficient.
tar -czvf ./backups/flarum_app_backup_$(date +%F_%H-%M-%S).tar.gz ./app
This command will create a compressed archive of the ./app directory.
3. Comprehensive Backup Script and External Storage
For reliability, it is recommended to create a script that will perform both operations and save backups to a secure location, such as a remote server or cloud storage. Consider using tools like Restic for incremental and encrypted backups, or rsync for synchronization with remote storage.
#!/bin/bash
BACKUP_DIR="./backups"
DATE=$(date +%F_%H-%M-%S)
DB_USER="flarum"
DB_PASS="your_db_password"
DB_NAME="flarum"
APP_DIR="./app"
DB_CONTAINER="flarum_db"
mkdir -p $BACKUP_DIR
echo "Creating database dump..."
docker compose exec $DB_CONTAINER sh -c "exec mariadb-dump -u $DB_USER -p$DB_PASS $DB_NAME > /tmp/flarum_db_backup.sql"
docker cp $DB_CONTAINER:/tmp/flarum_db_backup.sql $BACKUP_DIR/flarum_db_backup_$DATE.sql
docker compose exec $DB_CONTAINER rm /tmp/flarum_db_backup.sql # Remove temporary file from container
echo "Database dump created: $BACKUP_DIR/flarum_db_backup_$DATE.sql"
echo "Archiving application files..."
tar -czvf $BACKUP_DIR/flarum_app_backup_$DATE.tar.gz $APP_DIR
echo "Application files archive created: $BACKUP_DIR/flarum_app_backup_$DATE.tar.gz"
# Example of sending backups to a remote server (replace with your data)
# scp -r $BACKUP_DIR/* user@remote_server:/path/to/remote/backups/
echo "Backup completed."
Save this script as backup_flarum.sh, make it executable (chmod +x backup_flarum.sh), and add it to cron for daily execution.
Flarum and Docker Container Update Process
Updates are important for new features, security fixes, and performance improvements.
1. Updating Docker Images
Regularly update Docker images to the latest stable versions. This can be done by changing the image tags in docker-compose.yml (e.g., flarum/flarum:latest or a specific new version) and then running:
docker compose pull # Download new image versions
docker compose up -d # Recreate containers with new images
Always make a backup before updating!
2. Updating Flarum
If you are using a specific Flarum version (e.g., flarum/flarum:1.8.0), to update to a new version like 1.9.0, you will need to change the image tag in docker-compose.yml. However, Flarum also has its internal update procedure, especially for database migrations and plugin updates.
After updating the Flarum image in docker-compose.yml and restarting the containers, you may need to run the Flarum migration command:
docker compose exec flarum php flarum migrate
docker compose exec flarum php flarum cache:clear
Also, don't forget to update Flarum plugins via the administrator panel or, if necessary, via Composer (if you are using custom plugins not included in the main image).
Performance and Resource Monitoring
Monitoring your VPS and Flarum will help identify problems before they become critical.
- VPS Resource Usage: Use commands like
htop,free -h,df -hto track CPU, RAM, and disk space. If you see consistently high load, it might be time to scale your VPS. - Docker Container Logs: Check Flarum, Nginx/Caddy, and database logs for errors.
docker compose logs flarum
docker compose logs nginx # or caddy
docker compose logs db
Regular monitoring allows you to react promptly to problems and keep your Flarum in optimal condition.
Need a dedicated server?
Compare prices from top providers. Configure and order in minutes.
Optimal VPS Configuration for Flarum under Real-World Load
Choosing the right VPS configuration for Flarum is critical to ensuring stable operation and fast page loading as your community grows. Underestimating needs can lead to slow performance, failures, and a poor user experience, while excessive resources lead to unjustified costs. The optimal VPS configuration depends on the number of active users, the intensity of their interaction, and the number of installed plugins.
Resource Selection Based on User Count
When selecting a VPS for Flarum, several key factors must be considered:
- Number of active users: This is not the total number of registered users, but the number of those simultaneously viewing or interacting with the forum.
- Usage intensity: A forum where users primarily read will be less demanding than a forum with frequent posts, image uploads, and active searching.
- Number of plugins: Each plugin adds its own load on PHP and the database.
- Content volume: A large number of topics, posts, and attachments requires more disk space and can affect database performance.
- Disk type: NVMe SSD significantly outperforms regular SSDs and HDDs in I/O operations speed, which is critical for the database and caching.
Valebyte.com offers high-performance VPS with NVMe drives, which are ideally suited for I/O-intensive applications like Flarum.
Table: VPS Recommendations for Flarum
This table will help you choose the right Valebyte.com tariff plan for your Flarum forum, based on the anticipated load.
| Load (Active Users) | CPU (vCores) | RAM (GB) | Disk (NVMe SSD) | Bandwidth | Estimated Cost ($/month) | Notes |
|---|---|---|---|---|---|---|
| Starter/Small Forum (up to 50-100) |
1 | 1-2 | 20-40 GB | 1-2 TB | 5-10 | Suitable for testing, personal projects, and small communities. |
| Medium Forum (100-300) |
2 | 2-4 | 50-80 GB | 2-4 TB | 10-25 | Optimal for growing communities with moderate activity. |
| Active Forum (300-800) |
4 | 4-8 | 100-160 GB | 4-8 TB | 25-50 | For forums with high traffic and active interaction. |
| Large Forum (800-2000+) |
6-8+ | 8-16+ | 200-400+ GB | 8-16+ TB | 50-100+ | Requires database optimization and possibly caching (Redis/Memcached). |
Additional Recommendations:
- NVMe SSD: Always choose a VPS with NVMe SSD. The difference in I/O operations speed compared to regular SSDs or HDDs is immense and critical for Flarum's database performance.
- Server Location: Choose a data center that is geographically close to your primary audience to minimize latency.
- Caching: For medium and large forums, consider integrating caching systems such as Redis or Memcached for Flarum. This will significantly reduce database load and speed up page loading. Flarum has built-in caching support.
- PHP-FPM Workers: Optimize the number of PHP-FPM workers based on available RAM and CPU. Too many workers can lead to memory exhaustion, too few – to delays.
- Database Optimization: Regularly perform MySQL/MariaDB table optimization and indexing.
- CDN: For forums with a large number of images and static files, consider using a CDN (Content Delivery Network) to speed up their delivery to users worldwide.
Starting with a smaller plan and gradually scaling resources as you grow, you can effectively manage costs and ensure optimal performance for your Flarum forum on a VPS from Valebyte.com.
Conclusion
Deploying Flarum on a VPS using Docker Compose provides a powerful and flexible solution for creating a modern online community. This approach ensures full control over the infrastructure, high performance thanks to NVMe drives, and easy scalability as your project grows. By choosing a VPS from Valebyte.com, you get a reliable foundation for your forum, and following the recommendations for installation, HTTPS configuration, and regular maintenance guarantees stable and secure Flarum operation.
Ready to choose a server?
VPS and dedicated servers in 72+ countries with instant activation and full root access.
Get started now →