配置仓库:
# yum install epel-release安装配置:
# yum install nginx php php-devel php-fpm php-mysql php-redis mariadb mariadb-server mariadb-devel启动数据库服务:
# systemctl start mariadb通过MySQL客户端命令连接数据库服务: 创建数据库:
MariaDB [(none)]> create database discuz charset utf8; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all on discuz.* to "discuz"@localhost identified by "123456"; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec)上传网站代码:
# unzip Discuz_X3.1_SC_UTF8.zip -d /usr/share/nginx/html/ # chown apache. -R /usr/share/nginx/html/upload/修改nginx配置文件:
vim /etc/nginx/conf.d/default.conf location / { root /usr/share/nginx/html/upload; index index.php index.html index.htm; } +-- 17 行: #error_page 404 /404.html; ---------------------------------------------------------------------------------- location ~ \.php$ { root /usr/share/nginx/html/upload; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }启动nginx、php-fpm服务:
# systemctl start nginx php-fpm整合redis:
# yum install redis修改配置文件:
# grep "^bind" /etc/redis.conf bind 0.0.0.0启动redis服务:
# systemctl start redis修改discuz网站的配置文件:
# vim /usr/share/nginx/html/upload/config/config_global.php ---------------------- CONFIG MEMORY ---------------------- $_config['memory']['prefix'] = 'H9CYJk_'; $_config['memory']['redis']['server'] = '192.168.75.123'; $_config['memory']['redis']['port'] = 6379;验证缓存:
# redis-cli 127.0.0.1:6379> keys * 1) "H9CYJk_cronnextrun" 2) "H9CYJk_diytemplatenamehome" 3) "H9CYJk_onlinerecord" 4) "H9CYJk_diytemplatenameforum" 5) "H9CYJk_userstats"