Flarum 是一款非常棒的开源论坛程序。
安装 Caddy服务器
介绍 Caddy
安装PHP和依赖
sudo apt install php7.2
安装常用依赖
sudo apt install -y php7.2-cli php7.2-fpm php7.2-json php7.2-pdo php7.2-mysql php7.2-zip php7.2-gd php7.2-mbstring php7.2-curl php7.2-xml php7.2-bcmath php7.2-json
sudo systemctl restart php7.2-fpm
安装Mariadb
sudo apt install -y mariadb-server
测试 mysql -V
UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root' AND plugin = 'unix_socket';
FLUSH PRIVILEGES;
安装 Composer
Composer 就是 PHP 的一个包管理,类似 Java 的 Maven。
php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer
Composer提速
# 配置全局生效
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
# 取消全局配置
composer config -g --unset repos.packagist
安装 Flarum
mkdir flarum && cd flarum
composer create-project flarum/flarum . --stability=beta
然后等待下载 Flarum 以及对应的依赖即可,安装完成是这个样子的:
安装依赖包
在根目录执行
composer install
安装Flarum简体中文语言包:
composer require csineneo/lang-simplified-chinese
优化 Composer 自动加载:
composer dump-autoload --optimize
配置 Caddy
介绍 Caddy服务器
sudo chown www-data:www-data -R /var/www/
Caddyfile文件内容
# Caddyfile
http://xx.xx.xx.xx:4321 {
root /www/flarum/public
rewrite {
to {path} {path}/ /index.php
}
fastcgi / /var/run/php/php7.2-fpm.sock php
header /assets {
+Cache-Control "public, must-revalidate, proxy-revalidate"
+Cache-Control "max-age=25000"
Pragma "public"
}
gzip
}
配置 Flarum
汉化
安装 汉化插件后,用管理员账号进去网站后台,点开插件Extensions
,找到中文语言包,点一下就启用了:
参考:
https://jsthon.com/flarum-installation-guide/
https://github.com/Csineneo/lang-simplified-chinese
https://www.jingxialai.com/2600.html
https://flarum.org/docs/install.html#server-requirements
https://pkg.phpcomposer.com/
https://learnku.com/articles/15977/composer-accelerate-and-modify-mirror-source-in-china
https://ryanc.cc/archives/flarum-install-and-config
https://www.twblogs.net/a/5c0e71d4bd9eee5e40bacb85
https://www.mf8.biz/debian-install-php7-2/
网友评论