[Tutorial] How To Install Flarum On CyberPanel

  1. Create Website on Cyber Panel, my suggestion on sub domain (subdomain.domain.tld)

  2. SSH Login to server and check update
    sudo apt update && sudo apt upgrade

  3. Install composer
    sudo curl -s https://getcomposer.org/installer | php

  4. Move composer.phar to the /usr/local/bin/ directory.
    sudo mv composer.phar /usr/local/bin/composer

  5. Verify Composer Installation by checking its version.
    composer -V
    Output:
    Composer version 2.3.7 2022-06-06 16:43:28

  6. Change sudo user to root
    sudo su -

  7. Change to subdomain.domain.tld directory
    cd /home/subdomain.domain.tld/public_html

  8. Remove all files on the directory
    rm *

  9. Install Flarum
    composer create-project flarum/flarum . --stability=beta
    Continue as root/super user [yes]?
    yes

  10. Change owner and group for all files and directory
    chown -R USERNAME:GROUPNAME * && chown -R USERNAME:GROUPNAME .[^.]*

    * = all files
    .[^.]* = for all hidden files
    
  11. Create database for Flarum on Cyber Panel

  12. Go to subdomain.domain.tld/public and fill the setup form.

How to remove /public from the domain?

  1. Open public_html/config.php and find
    'url' => 'https://subdomain.domain.tld/public',
    Change to
    'url' => 'https://subdomain.domain.tld',

  2. Goto Cyber Panel manage website find Rewrite Rules and paste this and save.

    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]
    

Flarum Website

Thank you