1、关于Flarum 程序完美支持军哥lnmp环境/宝塔等,下载程序上传到网站根目录并需要伪静态+fileinfo扩展。
程序本地下载: FlarumChina-beta7.zip
Github下载地址: https://github.com/skywalker512/FlarumChina
fileinfo拓展
需要支持php扩展fileinfo。
1、对于lnmp1.3默认没有支持。修改include/upgrade_php.sh这个文件,把其中的:--disable-fileinfo,全部替换:--enable-fileinfo,再执行./upgrade.sh升级php就行了。
2、对于宝塔,安装后,找到你的PHP程序,里面有扩展可以选择安装。
2、centos安装LNMP支持flarun 2 | 1 数据库安装 sudo wget https: / / dev. mysql. com/ get/ mysql57- community- release- el7- 8 . noarch. rpm
yum - y install mysql57- community- release- el7- 10 . noarch. rpm
yum - y install mysql- community- server
systemctl start mysqld. service
2 | 2 mysql5.7获取密码的方式 sudo grep 'temporary password' / var / log/ mysqld. log
#添加validate_password_policy配置
validate_password_policy= 0
#关闭密码策略
validate_password = off
修改root密码
set global validate_password_policy= 0 ;
set global validate_password_length= 1 ;
ALTER USER 'root' @'localhost' IDENTIFIED BY 'MyNewPass4!' ;
grant all privileges on * . * to root@"%" identified by "new password" ;
flush privileges;
2 | 3 安装php7.2 sudo rpm - Uvh https: / / dl. fedoraproject. org/ pub/ epel/ epel- release- latest- 7 . noarch. rpm
sudo rpm - Uvh https: / / mirror. webtatic. com/ yum/ el7/ webtatic- release. rpm
yum install php72w- fpm php72w- cli php72w- curl php72w- dom php72w- gd php72w- json php72w- mbstring php72w- openssl php72w- pdo_mysql php72w- tokenizer php72w- zip - y
vim / etc/ php- fpm. d/ www. conf
#找到以下两处共四行代码并修改如下:
user = nginx
group = nginx
listen. owner = nginx
listen. group = nginx
3、安装Flarum 方法一:下载=即使用整合包
https://github.com/skywalker512/FlarumChina/releases/tag/v0.1.0-beta.12
方法二:composer拉取 (比较建议后面装插件都是用的composer)
3 | 1 安装composer 下载composer.phar, 如果是网络原因失败,多试几次
curl - sS https: / / getcomposer. org/ installer | php
把composer.phar移动到环境下让其变成可执行:
mv composer. phar / usr/ local/ bin/ composer
测试
修改镜像地址
composer config repo. packagist composer https: / / mirrors. aliyun. com/ composer/
3 | 2 安装ningx yum - y install nginx unzip
进入wwwroot目录中使用composer命令来安装flarum:
mkdir / var / www/ flarum/
cd / var / www/ flarum/
composer create- project flarum/ flarum . -- stability= beta #不用使用管理员权限命令sudo。
完毕后修改nginx中的默认配置文件:
sudo vim / etc/ nginx/ nginx. conf
#将server代码段下的所有代码都用#注释掉
#server {
# listen 80 default_server;
# listen [ : : ] : 80 default_server;
# server_name _;
# root / usr/ share/ nginx/ html;
# # Load configuration files for the default server block.
# include / etc/ nginx/ default . d
注意:因为Flarum遵守了最新的安全规范,其程序的运行目录其实是在public文件夹内。
4、插件安装 https://bbs.csur.fun/d/84-flarum
5、虚拟机搭建 买个虚拟机 做网页,诸多限制,虚拟机服务商的提供的服务确实就两字“操蛋”。
为什么没有买云服务器?就两字 “没钱”!哈哈。
虚拟机的购买途径自寻,但是很多服务商真的很坑爹。
虚拟机要求
php支持7.2以上 mysql支持5.7以上 能够支持更改网站跟目录 6、更改网站根目录层级 将 public 目录(包括 .htaccess)中的所有文件移动到 Flarum 根目录。然后编辑 .htaccess 取消第 9-14 行的注释,以保护敏感资源。
然后编辑 index.php 文件,更改以下行:
$site = require './site.php' ;
最后,在 site.php 更新路径,以反映新的目录结构:
'base' => __DIR__,
'public' => __DIR__,
'storage' => __DIR__. '/storage' ,
config.php 更新 url 路径
'url' => 'https://xxx.com/community' ,
不更改网站层级目录
请根据你的虚拟主机面板的不同,将网站运行目录指向public文件夹。
如果您使用的是虚拟主机无法更改目录,请按照一下的方法进行设置
在根目录下新建一个名为 .htaccess的文件
RewriteEngine on
RewriteCond % { REQUEST_URI } ! ^ / public /
RewriteRule ^ ( . * ) $ / public / $1 [ L ]
7、其他 底部加统计 vendor/ flarum/ core/ views/ app. blade. php
去掉网络字体 vendor/ flarum/ core/ src/ Http/ WebApp/ WebAppView. php
伪静态设置 Nginx的话在站点配置文件处添加下面一段话。
location / {
try_files $uri $uri/ / index. php? $query_string;
}
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 ;
}
location ~ . php$ {
fastcgi_split_path_info ^ ( . + . php) ( / . + ) $;
fastcgi_pass unix: / tmp/ php- cgi. sock;
fastcgi_index index. php;
include fastcgi. conf;
}
本文由LIKE.TG编辑部转载自互联网并编辑,如有侵权影响,请联系官方客服 ,将为您妥善处理。
This article is republished from public internet and edited by the LIKE.TG editorial department. If there is any infringement, please contact our official customer service for proper handling.