Centos相关,  个人笔记

用flarum搭建论坛

1、首先配置好nginx  /etc/nginx/conf.d/flarum.conf  
server {    
    listen 8082;
    server_name oneai.eu.org;
    root  /var/www/html/flarum/public;
    index index.php index.html;

    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
location / {
  try_files $uri $uri/ /index.php?$query_string;
}

# The following directives are based on best practices from H5BP Nginx Server Configs
# https://github.com/h5bp/server-configs-nginx

# Expire rules for static content
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
  add_header Cache-Control "max-age=0";
}

location ~* \.(?:rss|atom)$ {
  add_header Cache-Control "max-age=3600";
}

location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ {
  add_header Cache-Control "max-age=2592000";
  access_log off;
}

location ~* \.(?:css|js)$ {
  add_header Cache-Control "max-age=31536000";
  access_log off;
}

location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
  add_header Cache-Control "max-age=2592000";
  access_log off;
}

# Gzip compression
gzip on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
    application/atom+xml
    application/javascript
    application/json
    application/ld+json
    application/manifest+json
    application/rss+xml
    application/vnd.geo+json
    application/vnd.ms-fontobject
    application/x-font-ttf
    application/x-web-app-manifest+json
    application/xhtml+xml
    application/xml
    font/opentype
    image/bmp
    image/svg+xml
    image/x-icon
    text/cache-manifest
    text/css
    text/plain
    text/vcard
    text/vnd.rim.location.xloc
    text/vtt
    text/x-component
    text/x-cross-domain-policy;    
}
配置文件更改需要重启nginx  :systemctl restart nginx
---2、创建数据库:
mysql -uroot -p
create database flarum;

GRANT ALL PRIVILEGES ON flarum.* TO 'flarum'@'localhost' IDENTIFIED BY  'FlarumForT2023';
GRANT ALL PRIVILEGES ON flarum.* TO 'flarum'@'127.0.0.1' IDENTIFIED BY  'FlarumForT2023';
GRANT ALL PRIVILEGES ON flarum.* TO 'flarum'@'%' IDENTIFIED BY  'FlarumForT2023';
GRANT ALL PRIVILEGES ON flarum.* TO 'root'@'localhost' identified by 'Familyun@mysql1' WITH GRANT OPTION;

FLUSH PRIVILEGES;
3、
--------从官网下载安装包,放到下面的路径下,也可以直接用命令下载: composer create-project flarum/flarum .  
/var/www/html/flarum 
然后访问:8082端口进行安装 
4、安装相关插件
最好是添加一个用户,然后用创建的用户进行相关插件安装
adduser -m composer
su- composer
添加国内源:
阿里云

使用说明:https://mirrors.aliyun.com/composer/

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
华为云

composer config -g repo.packagist composer https://mirrors.huaweicloud.com/repository/php/
腾讯云

composer config -g repos.packagist composer https://mirrors.cloud.tencent.com/composer/
cnpkg

composer config -g repos.packagist composer https://php.cnpkg.org](https://php.cnpkg.org
phpcomposer

Composer官方镜像,速度较慢,国外服务器用这个!!!

composer config -g repo.packagist composer https://packagist.phpcomposer.com

-------
5、安装插件:找到插件根据提示安装
这里有一些常用的插件分类:https://github.com/realodix/awesome-flarum#theme-enhancements-top
根据自己的论坛特点选取安装 
这里有一些插件:
https://extiverse.com/?filter%5Bq%5D=&sort=-downloads&filter%5Bis%5D%5B%5D=-flarum&filter%5Btype%5D=
这里有一些插件 https://discuss.flarum.org/
composer require flarum-lang/chinese-traditional  //中文语言包
php flarum cache:clear

如果composer 提示要升级请参照:https://qiita.com/mugimugi/items/149446c39005c039a391
用flarum搭建论坛已关闭评论