为方便学员和网友提问,回答.这几天在尝试着搭建些轻爽界面的轻社区系统.flarum就是其中之一
服务器系统准备,centos7.5.64位系统.
1.编译代码
yum install -y pcre pcre-devel openssl openssl-devel
yum install gcc-c++ -y
yum install gcc -y
mkdir /server/tools/ -p
cd /server/tools/
yum install -y pcre pcre-devel openssl openssl-devel
useradd nginx -s /sbin/nologin -M
wget http://nginx.org/download/nginx-1.17.8.tar.gz
tar xzf nginx-1.17.8.tar.gz
cd nginx-1.17.8
./configure --prefix=/application/nginx-1.17.8 --user=nginx --group=nginx --with-http_sub_module --with-http_ssl_module
make
make install
/application/nginx-1.17.8/sbin/nginx -t
/application/nginx-1.17.8/sbin/nginx
netstat -lntup|egrep "nginx"
2.1.官方文档要求如下
所以选择mysql5.7,Cmake安装
tar zxf cmake-3.16.4.tar.gz
./configure
gmake
gmake install
cd ..
报错:
This CMake script will look for boost in <directory>. If it is not there it will download and unpack it (in that directory) for you.
解决方法参考:https://blog.csdn.net/u012767761/article/details/78185768/
编译参数添加
继续安装
修改配置文件,vim /etc/my.cnf
[mysqld]
basedir=/application/mysql-5.7.29/
datadir=/application/mysql-5.7.29/data/
socket = /application/mysql-5.7.29/tmp/mysql.sock
user = mysql
tmpdir = /application/mysql-5.7.29/tmp
symbolic-links=0
[mysqld_safe]
log-error = /application/mysql-5.7.29/tmp/error.log
pid-file = /application/mysql-5.7.29/tmp/mysql.pid
启动服务
通过临时密码,进入客户端.改root密码
3.1.下载源码
https:
//www.php.net/downloads.php
3.2.安装依赖库
yum -y install wget pcre pcre-devel openssl openssl-devel libicu-devel autoconf libjpeg libjpeg-devel \
libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel \
glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap \
openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel \
gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline \
readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel
gdbm-devel
3.3.增加运行的用户组
groupadd www
useradd -g www www
3.4.解压编译安装
报错,解决办法
1、configure: error: DBA: Could not find necessary header file(s).
安装下 yum install gdbm-devel
2、configure: error: Cannot find ldap libraries in /usr/lib
拷贝下文件 cp -frp /usr/lib64/libldap* /usr/lib/
3.configure: error: Please reinstall the libzip distribution
在 https://libzip.org/download/ 下载源码,进行安装
tar xf libzip-1.5.2.tar.gz
cd libzip-1.5.2
mkdir
build && cd build && cmake .. && make && make install
configure: error: off_t undefined; check your library configuration
进行如下操作:
vi /etc/ld.so.conf
# 添加如下几行
/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64
# 保存退出
:wq
# 使之生效
ldconfig -v
解决上述问题.继续编辑
安装
3.5.安装后的配置
复制配置文件
修改配置文件如下选 项
max_execution_time = 120
max_input_time = 120
memory_limit = 1024M
post_max_size = 128M
date
.timezone = PRC
extension_dir = "/application/php-7.3.14/lib/php/extensions/no-debug-zts-20180731"
增加服务启动配置文件,启动测试
检查效果
官方网址https://getcomposer.org/download/,安装前,增加下php环境变量,执行如下命令
增加环境变量: export PATH=/application/mysql/bin:/application/php-7.3.14/bin:$PATH php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');"
移动 composer.phar,这样 composer 就可以进行全局调用:
#mv composer.phar /usr/local/bin/composer
切换国内源
composer config -g repo.packagist composer https://packagist.phpcomposer.com composer selfupdate
创建网站目录,然后在网站目录下面运行
composer create-project flarum/flarum . --stability=beta
安装下中文语言包
修改网站文件权限和属主
配置Nginx,增加如下配置文件.并把程序包里面的.nginx.conf文件加载
server {
listen 80;
server_name ask.tfst8.com;
root /data/www/ask/public;
#location / {
# index index.php index.html index.htm;
#}
location ~ .*\.(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
access_log logs/access.log main;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
include /application/nginx-1.17.8/conf/conf.d/*.conf;
}
ask.conf
# Pass requests that don't refer directly to files in the filesystem to index.php
location / {
try_files $uri $uri/ /index.php?$query_string;
index index.php index.html index.htm;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# 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;
4.3.创建数据库
建立数据库,运行安装程序.一切顺利
附:插件单点登陆官网
https://flagrow.io/extensions/maicol07/flarum-ext-sso
https://github.com/fabwu/flarum-ext-sso
https://discuss.flarum.org/
上传图片插件安装报错处理:
少了php扩展exif:
在phpinfo中可以看到如下插件
EXIF Support | enabled |
Supported EXIF Version | 0220 |
Supported filetypes | JPEG, TIFF |
Multibyte decoding support using mbstring | enabled |
Extended EXIF tag formats | Canon, Casio, Fujifilm, Nikon, Olympus, Samsung, Panasonic, DJI, Sony, Pentax, Minolta, Sigma, Foveon, Kyocera, Ricoh, AGFA, Epson |
成功安装好.flarum编辑器的上传插件
fof-upload | 0.8.2
csineneo-lang-simplified-chinese | 1.11.12 | |
| maicol07-sso | 1.4.5
GD库的安装