安装flarum的php扩展,Flarum beta9 安装

一、compsoser 安装 Flarum 源码

先创建一个空文件夹作为项目目录,安装命令就是Flarum官方的命令:

sudo mkdir flarum // 项目目录名自己定义

sudo chmod 777 flarum // 为避免后面关于文件权限的问题,这里暂且给所有权

cd flarum

composer create-project flarum/flarum . --stability=beta

此处可能会报错,多为PHP的各种扩展的报错,如:curl、fileinfo。如果出现相关报错,请参考我的PHP安装教程:

Ubuntu 编译安装PHP7.3.8

二、Flarum Nginx 配置

安装完成后,我们先进行nginx配置,官方有nginx配置的样板,大家可以参考:

官方nginx配置参考

下面是我的nginx配置,供大家参考:

server {

listen 80;

listen [::]:80;

server_name bbs.678fly.cn; // 你的域名

root /var/www/flarumbbs/public; // 项目根目录

index index.php index.htm index.html;

access_log /var/log/nginx/bbs.678fly.cn.access.log;

error_log /var/log/nginx/bbs.678fly.cn.error.log;

# 此处以下都是复制的官方的配置,没有进行任何修改

location ~* \.php$ {

fastcgi_index index.php;

fastcgi_pass 127.0.0.1:9000;

include fastcgi_params;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;

}

# Pass requests that don't refer directly to files in the filesystem to index.php

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即可

cd /etc/init.d

sudo nginx -s reload

三、Flarum 数据库配置

1、创建 Flarum 数据库

这里就不详细讲了,自己想好数据库名,编码设置 utf8 就行了。

2、Flarum 首次进入配置

浏览器输入域名进入首页,首次进入会有一些基本配置。安装的时候忘了截图,大概有以下需要配置项:

数据库:包括 IP、数据库名、数据库用户名和密码

管理员信息:包括用户名、密码和邮箱

填完表单提交就OK了。大功告成!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值