欢迎光临
我们一直在努力

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

LALA

我什么都不卖了,告辞!

赞(0)
未经允许不得转载:拆东墙 » Debian11安装Flarum

评论 抢沙发

登录

找回密码

注册