本教程仅适用于Cloudpanel管理面板

1、Create Website on Cloud Panel

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

输出:

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/*siteuser*/htdocs/*subdomain.domain.tld*

8、Remove all files on the directory

rm *

9、Install Flarum

composer create-project flarum/flarum . --stability=beta

10、Change owner and group for all files and directory

chown -R USERNAME:GROUPNAME * && chown -R USERNAME:GROUPNAME .[^.]* 

USERNAME:GROUPNAME = siteuser:siteuser
* = all files
.[^.]* = for all hidden files

11、Create database for Flarum on Cloud Panel

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


How to remove /public from the domain?

  1. Move whatever is in public to the home directory.
  2. open index.php file and change as below

    $site = require './site.php';

  3. Open the site.php file and change it as follows (不要弄混了句号和逗号)

    'base' => __DIR__,
    'public' => __DIR__,
    'storage' => __DIR__.'/storage',

安装注意事项

安装新插件,需转到Flarum安装目录执行命令,特别注意清空缓存