静看光阴荏苒
不管不顾不问不说也不念

Debian11安装Flarum

最近要搭个论坛,试了几个开源的论坛程序,这其中就有flarum,虽然最后我还是选择用discourse了,但flarum的安装步骤还是在这里记录下,留给需要的人。

安装nginx/mariadb/certbot:

apt -y update
apt -y install nginx python3-certbot-nginx mariadb-server

添加sury的php存储库:

apt -y install curl apt-transport-https ca-certificates lsb-release
curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
apt -y update

安装php8.2:

apt -y install php8.2-common php8.2-fpm php8.2-curl \
php8.2-dom php8.2-gd php8.2-mbstring \
php8.2-mysql php8.2-zip

设置开机自启:

systemctl enable nginx mariadb php8.2-fpm

安装composer:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

初始化mariadb:

mysql_secure_installation

登录到数据库:

mysql -u root -p

创建数据库和用户:

CREATE DATABASE flarum CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON flarum.* TO flarum@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
quit

创建并进入到flarum目录:

mkdir -p /var/www/flarum
cd /var/www/flarum

获取flarum以及安装所需的依赖、扩展:

composer create-project flarum/flarum .

修改目录权限和所有者:

chmod -R 775 /var/www/flarum
chown -R www-data:www-data /var/www/flarum

新建nginx配置文件:

nano /etc/nginx/sites-available/flarum

写入如下配置:

server {
    server_name bbs.example.com;
    root /var/www/flarum/public;
    index index.php;
    client_max_body_size 0;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    }

    include /var/www/flarum/.nginx.conf;
}

启用新的nginx配置:

ln -s /etc/nginx/sites-available/flarum /etc/nginx/sites-enabled/flarum

签发ssl证书:

certbot --nginx

访问你的域名填写各类信息完成安装:

如果需要修改php以及fpm相关的设置,例如文件上传大小、进程数量等:

nano /etc/php/8.2/fpm/pool.d/www.conf
nano /etc/php/8.2/fpm/php.ini

重启phpfpm:

systemctl restart php8.2-fpm
赞(1)
未经允许不得转载:荒岛 » Debian11安装Flarum
分享到: 更多 (0)

评论 6

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    论坛地址呢? :oops:

    star2年前 (2023-05-09) Microsoft Edge 112.0.1722.44 Microsoft Edge 112.0.1722.44 iPhone iOS 16.2 iPhone iOS 16.2回复
  2. #2

    另外,请教一下大佬,有研究过flarum搬家到discourse吗?我以前用的就是flarum,坚持了几年实在是不合适,现在决定改用discourse,搬家有点难啊! :cry:

    star2年前 (2023-05-09) Microsoft Edge 112.0.1722.44 Microsoft Edge 112.0.1722.44 iPhone iOS 16.2 iPhone iOS 16.2回复
    • 搬不了,既然坚持这么多年了那就将就用吧,或者干脆建个新的。

      LALA2年前 (2023-05-12) Google Chrome 111.0.0.0 Google Chrome 111.0.0.0 Windows 10 x64 Edition Windows 10 x64 Edition回复
  3. #3

    其实弄个电报群更实际一点

    Foliage2年前 (2023-05-10) Google Chrome 112.0.0.0 Google Chrome 112.0.0.0 Windows 10 x64 Edition Windows 10 x64 Edition回复

分享创造快乐

广告合作资源投稿