翼度科技 发表于 2023-1-4 19:39:51

手把手教你为Discuz配置Redis缓存

本教程基于Discuz3.4版本开启Redis。使用环境:
操作系统:CentOS7.9
堡塔面板版本:正式版7.9.1
Nginx:1.20
PHP:7.4
MySQL:5.7
Redis:6.2.6
https://www.bt.cn/bbs/data/attachment/forum/202205/23/152659l7qq5n5tacc5lugc.png
安装php7.4中的redis扩展
https://www.bt.cn/bbs/data/attachment/forum/202205/23/152713xei5bs52q52zih5a.png
首先登录到Discuz论坛的后台图:
看到这里是支持的
https://www.bt.cn/bbs/data/attachment/forum/202205/23/152733yhubvbnvuhsjzpbu.png
然后打开Discuz的网站配置文件,
/www/wwwroot/189.dapaoit.com/config/config_global.php
// --------------------------CONFIG MEMORY--------------------------- //
$_config['memory']['prefix'] = 'gdBWWJ_';
$_config['memory']['redis']['server'] = '127.0.0.1';
$_config['memory']['redis']['port'] = 6379;
$_config['memory']['redis']['pconnect'] = 1;
$_config['memory']['redis']['timeout'] = '0';
$_config['memory']['redis']['requirepass'] = 'dapao666!';
$_config['memory']['redis']['serializer'] = 1;
$_config['memory']['memcache']['server'] = '';
$_config['memory']['memcache']['port'] = 11211;
$_config['memory']['memcache']['pconnect'] = 1;
$_config['memory']['memcache']['timeout'] = 1;
$_config['memory']['apc'] = '0';
$_config['memory']['apcu'] = '0';
$_config['memory']['xcache'] = '0';
$_config['memory']['eaccelerator'] = '0';
$_config['memory']['wincache'] = '0';
$_config['memory']['yac'] = '0';
$_config['memory']['file']['server'] = '';

$_config['memory']['redis']['server'] = '127.0.0.1';$_config['memory']['redis']['requirepass'] = 'dapao666!';
这两行,第一行是配置Redis的主机,第二行是配置Redis的密码(如果没有设置可以忽略)
配置好后,重新刷新下Dz论坛后台,可以看到有Redis的支持,打开,清理缓存的
https://www.bt.cn/bbs/data/attachment/forum/202205/23/152746octtff3ztkw2o446.png

打开Redis可视化工具,查看缓存的数据
https://www.bt.cn/bbs/data/attachment/forum/202205/23/153048kdhwlbvjzdl4wjm0.png


以上就是开启Discuz开启Redis缓存的全部操作了,如有您有什么疑问可以在下面留言。

页: [1]
查看完整版本: 手把手教你为Discuz配置Redis缓存