Independent testing Updated April 2026 387 self-hosting guides 5 VPS providers tested

guide

How to Self-Host Flarum on a VPS (Complete Guide)

Learn how to self-host Flarum on a VPS with a step-by-step guide covering installation, configuration, and securing Flarum for reliable daily use.

How to Self-Host Flarum on a VPS (Complete Guide)

Flarum is a modern, open-source forum software designed for simplicity and ease of use. Self-hosting Flarum allows you control over your forum while providing the flexibility to customize features as per your needs. This guide will walk you through the process of installing Flarum on a VPS, including options for using Docker for virtualization.

1. Choosing a VPS Provider

Selecting the right VPS provider is critical for performance and reliability. Below is a comparison of some top providers suitable for hosting Flarum:

ProviderMonthly Cost (EUR/USD)RAMStorageLink
Contabo VPS5.99 EUR4 GB200 GB SSDContabo
Hetzner Cloud4.15 EUR2 GB20 GB SSDHetzner
DigitalOcean6 USD1 GB25 GB SSDDigitalOcean
Vultr6 USD1 GB25 GB SSDVultr
Linode (Akamai)5 USD2 GB25 GB SSDLinode

For users prioritizing budget, Hetzner Cloud and Contabo offer excellent options with good RAM and storage.

2. Preparing the VPS

Once you have chosen your VPS provider and provisioned your server, you need to prepare it for Flarum installation.

Step-by-Step Preparation:

  1. Access your VPS: Use SSH to connect to your VPS. Replace user and your-vps-ip accordingly.

    ssh user@your-vps-ip
  2. Update the System: Ensure your system packages are current.

    sudo apt update && sudo apt upgrade -y
  3. Install Required Software: Flarum requires PHP, Composer, a web server like Nginx or Apache, and a database like MySQL or MariaDB.

    sudo apt install -y nginx mysql-server php php-mysql php-fpm php-xml php-mbstring php-json curl unzip

3. Setting Up the Database

  1. Log into MySQL:

    sudo mysql -u root -p
  2. Create a Database and User:

    CREATE DATABASE flarum;
    CREATE USER 'flarumuser'@'localhost' IDENTIFIED BY 'your_password';
    GRANT ALL PRIVILEGES ON flarum.* TO 'flarumuser'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;

4. Installing Flarum

  1. Navigate to the web directory:

    cd /var/www/
  2. Download Flarum:

    curl -LO https://flarum.org/download/latest
    unzip latest
    mv flarum-* flarum
  3. Set Permissions:

    sudo chown -R www-data:www-data flarum
    sudo chmod -R 755 flarum
  4. Composer Install:

    Navigate to the Flarum directory and run:

    cd flarum
    composer install

5. Configure Nginx

Create a new Nginx configuration file for your Flarum instance.

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

Add the following configuration:

server {
    listen 80;
    server_name 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$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.x-fpm.sock; # Adjust PHP version if necessary
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}

6. Enable the Nginx Configuration

After configuring Nginx, enable the site and restart the service.

sudo ln -s /etc/nginx/sites-available/flarum /etc/nginx/sites-enabled/
sudo systemctl restart nginx

7. Finishing Up

You can now visit http://your_domain.com in your web browser to complete the Flarum installation via the GUI. Follow the prompts to connect to your database and set up your admin account.

FAQs

1. What are the benefits of self-hosting Flarum?

Self-hosting Flarum grants you complete control over your forum environment. You can customize settings, ensure data privacy, and install plugins without restrictions. By managing the server, you also minimize downtime and maintain a customized experience based on your specific needs and user base.

2. Can I install Flarum using Docker?

Yes, Flarum can be easily installed using Docker. Docker allows you to run Flarum in isolated containers, simplifying the management of dependencies. You will need a Docker-compatible VPS and set up Docker Compose to define your environment, including PHP, MySQL, and Nginx in easy-to-manage configurations.

3. What are the system requirements for running Flarum?

Flarum requires a VPS with at least PHP 7.3, a web server (Nginx or Apache), and a MySQL or MariaDB database. It’s recommended to have a minimum of 1 GB of RAM, but greater resource allocation will improve performance, particularly with multiple concurrent users. You can check the complete requirements in the Flarum documentation.

By following this guide, you should be able to successfully self-host Flarum on your chosen VPS provider. For a broader comparison of VPS options, visit our full VPS comparison. Happy hosting!