Flarum是一个免费且开源论坛组件。这里记录了我部署Flarum论坛的过程。
一、环境
- php 8.0
- MariaDB 10.6.4 database server;
- Debian 10;
- nginx: 1.14.2;
- 用户:winbert,非root
二、部署过程
2.1 部署composer
winbert@winbert-debian:~/flarum$ pwd
/home/winbert/flarum
winbert@winbert-debian:~/flarum$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
winbert@winbert-debian:~/flarum$ php composer-setup.php
All settings correct for using Composer
Downloading...
Composer (version 2.1.11) successfully installed to: /home/winbert/flarum/composer.phar
Use it: php composer.phar
winbert@winbert-debian:~/flarum$ php -r "unlink('composer-setup.php');"
winbert@winbert-debian:~/flarum$
winbert@winbert-debian:~/flarum$
winbert@winbert-debian:~/flarum$ ls -al
total 2248
drwxr-xr-x 2 winbert winbert 4096 Nov 9 05:17 .
drwxr-xr-x 9 winbert winbert 4096 Nov 9 05:17 ..
-rwxr-xr-x 1 winbert winbert 2286233 Nov 9 05:17 composer.phar
winbert@winbert-debian:~/flarum$
winbert@winbert-debian:~/flarum$ sudo mv composer.phar /usr/local/bin/composer
winbert@winbert-debian:~/flarum$ composer --version
Composer version 2.1.11 2021-11-02 12:10:25
2.2 部署flarum
注意: Php安装后,默认的运行用户及用户组是www-data:www-data
,这里我使用的winbert用户,所以你的情况跟我一样的话,请修改为你的当前用户,不然部署flarum及其他组件的时候会提示没有权限,修改方式参考: 如何更改php的运行用户?
winbert@winbert-debian:~/www/html/flarum$ pwd
/home/winbert/www/html/flarum
winbert@winbert-debian:~/www/html/flarum$
winbert@winbert-debian:~/www/html/flarum$
winbert@winbert-debian:~/www/html/flarum$ composer create-project flarum/flarum .
2.3 安装插件
flarum支持安装额外的插件,来完善自身功能,以安装简体中文包为例:
composer require flarum-lang/chinese-simplified
php flarum cache:clear
执行命令的位置是composer.json
及composer.lock
所在目录。
三、访问论坛主页,进行论坛配置
我的nginx配置如下:
server {
server_name bbs.ddmit.com;
root /home/winbert/www/html/flarum/public;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
access_log /var/log/nginx/ddmit-bbs.access.log;
error_log /var/log/nginx/ddmit-bbs.error.log;
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include fastcgi_params;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php8.0-fpm.sock;
# With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_param HTTP_HOST $host;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
}
其中主目录root对应的是flarum下的public目录。在浏览器输入论坛名称,数据库信息进行配置即可。
参考:
最新评论
网飞没问题, 迪士尼+有解决方案么?
pp助手是安卓手机用的,根本下载用不来苹果
已解决
这样的话数据库里的结构为{"attachment":{"content":"xxx"}}, 要怎么才能变成{"content":"xxx"},从而使结构保持一致?
赞! make test不过的坑都写到的,谢谢楼主~
谢谢你
用了root用户还是一直502是怎么回事呢
student id 是空的