基于 Flarum 搭建论坛网站实践

本文介绍在 Nginx 服务器下基于 Flarum 搭建论坛网站。

Flarum 是一款现代的,优雅的,简洁的,强大的论坛软件。Flarum 让在线交流变得更加轻松愉快。

官网地址:http://flarum.org

中文网:http://flarum.org.cn

Flarumchina:https://flarumchina.org

安装部署 Flarum

1、官方推荐使用 Composer 安装,

这里需要安装 Composer 工具

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
composer config -g repo.packagist composer https://packagist.phpcomposer.com # 替换中国镜像源

然后执行如下命令即可安装,注意需要在空目录下执行

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

2、这里推荐使用 Flarumchina 的中文版安装包

源码地址 https://github.com/skywalker512/FlarumChina

我们把源文件上传到服务器,解压即可完成安装。

针对 Nginx 服务器,需要配置写规则。

location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
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;
}

配置 HTTPS 访问

在根目录下 config.php 文件中,将 url 修改为 https 协议即可。

最后,欢迎访问我搭建的论坛 http://bbs.wshunli.com

参考资料
1、轻论坛:Flarum 程序安装指南
https://jsthon.com/flarum-installation-guide/
2、遇见最美社区——Flarum | MIKELIN
https://mikelin.cn/740.html
3、Installation | Flarum Documentation
https://flarum.org/docs/install.html#installing
4、Installation
https://www.flarumchina.org/docs/installation/
5、Ubuntu 16.04 & Nginx 下配置 Flarum | Homulilly
https://homulilly.com/post/install-flarum-on-ubuntu-16-04-with-nginx.html