📰

Flarum

2 notes  •  WordPress & CMS

Configure Flarum Email Settings

Configure outgoing email settings in Flarum so the forum can send notifications, password resets, and verification emails.

Admin Panel Method

  1. Log in as an administrator.
  2. Go to Admin Panel → Mail.
  3. Set the Mail Driver to your preferred method: SMTP, Mailgun, Log (dev only), or Sendmail.
  4. For SMTP, fill in the fields:
Host        : smtp.example.com
Port        : 587
Encryption  : TLS
Username    : your@email.com
Password    : yourpassword
  1. Save and send a test email to confirm delivery.

config.php Method

Alternatively, set mail config directly in config.php in the Flarum root:

return [
    'mail.driver'   => 'smtp',
    'mail.host'     => 'smtp.example.com',
    'mail.port'     => 587,
    'mail.username' => 'your@email.com',
    'mail.password' => 'yourpassword',
    'mail.encryption' => 'tls',
    'mail.from.address' => 'noreply@example.com',
    'mail.from.name'    => 'My Forum',
];

Verify

Use the Send Test Mail button in the admin panel, or trigger a password reset for a test account.

Install Flarum on Nginx (Ubuntu)

Install Flarum forum software on an Ubuntu server running Nginx, PHP-FPM, and MySQL.

Prerequisites

  • Ubuntu 20.04+ with a non-root sudo user
  • Nginx, PHP 8.x with PHP-FPM, MySQL/MariaDB installed
  • A domain name pointing to the server

Step 1 - Install PHP Extensions

sudo apt update
sudo apt install php8.1 php8.1-fpm php8.1-mysql php8.1-mbstring \
    php8.1-xml php8.1-curl php8.1-zip php8.1-gd php8.1-tokenizer
sudo apt install composer

Step 2 - Create a MySQL Database

sudo mysql -u root -p
CREATE DATABASE flarum CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'flarum'@'localhost' IDENTIFIED BY 'StrongPassword!';
GRANT ALL ON flarum.* TO 'flarum'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 3 - Install Flarum with Composer

cd /var/www
sudo composer create-project flarum/flarum forum
sudo chown -R www-data:www-data /var/www/forum
sudo chmod -R 755 /var/www/forum

Step 4 - Configure Nginx

Create /etc/nginx/sites-available/forum:

server {
    listen 80;
    server_name forum.example.com;
    root /var/www/forum/public;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php8.1-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}
sudo ln -s /etc/nginx/sites-available/forum /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx

Step 5 - Complete Web Installation

Visit http://forum.example.com in a browser and follow the installation wizard. Enter database credentials and create the admin account.

Verify

After installation, log in as admin and confirm the forum is accessible and email works.