You must have SSH access to a server with PHP 7.2+ and MySQL 5.6+

当前环境 Nginx1.17 Mysql5.7 PHP7.4

  • 安装宝塔
    # Centos
    yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

    # Ubuntu
    wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh

    # Debian
    wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh
  • 安装Composer
    curl -sS https://getcomposer.org/installer | php
    mv composer.phar /usr/local/bin/composer
  • 在线安装
    # 当前最新版本13  2020年5月13日 18:05:19
    composer create-project flarum/flarum . --stability=beta

    chown -R www:www ./
    chmod -R 775 assets storage


    # 安装缓慢,可以切换国内源
    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

    # 恢复默认
    composer config -g --unset repos.packagist



    # 还是下载不下来的,可以去github下载打包好的
    https://github.com/skywalker512/FlarumChina/releases

需确保将您的网站运行目录设置为 /path/to/your/forum/public

  • 安装 php扩展
# PHP管理-设置-安装Fileinfo扩展
# 安装 PHP 扩展 exif 后方可上传图片 (Upload by FriendsOfFlarum)
  • URL 重写规则

应该我的是Nginx,其他请参考:https://discuss.flarum.org.cn/d/1246

# Flarum 包含一个 .nginx.conf 文件。 然后,假设您在 Nginx 中创建了一个 PHP 站点,请将以下内容添加到服务器的配置块中:

include /www/wwwroot/xxx.com/.nginx.conf;


# 添加伪静态


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

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

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

location /flarum {
deny all;
return 404;
}

location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/tmp/php-cgi-74.sock;
fastcgi_index index.php;
include fastcgi_params;
}

  • 中文插件
composer require littlegolden/flarum-lang-simplified-chinese
composer require csineneo/lang-traditional-chinese

# 移除

composer remove littlegolden/flarum-lang-simplified-chinese
composer remove csineneo/lang-traditional-chinese