5

消除nextcloud“内存缓存未配置”的警告——配置Redis作为内存缓存教程 | 解决办法

 2 years ago
source link: https://hellodk.cn/post/44
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

消除nextcloud“内存缓存未配置”的警告——配置Redis作为内存缓存教程 | 解决办法

很长时间没有进设置看软路由中部署的nextcloud服务的情况。登录后发现http://10.10.10.1:99/settings/admin该页给予了一个警告:

内存缓存未配置,为了提升使用体验,请尽量配置内存缓存。

官方也给出了一个文档,可供查阅,:
https://docs.nextcloud.com/server/13/admin_manual/configuration_server/caching_configuration.html,有耐心的朋友可以慢慢阅读。

内存缓存未配置警告

由于我的软路由中已经配置好了redis,故本文中不涉及redis的安装和配置,如有需要可google之,文章很多。Redis是一个出色的现代内存缓存,可用于分布式缓存,也可用作事务性文件锁定的本地缓存,因为它可以保证缓存对象在需要时可用。 对应的Redis PHP模块必须是2.2.6+版本。下面给出解决办法。
解决办法

一、使用ps查看redis运行情况

# ps |grep redis
7595 root 30872 S redis-server 127.0.0.1:6379

redis已在运行,通信端口6379(6379是Redis默认通讯端口)。
二、配置nextcloud的config.php文件

1、通过find等等命令找到nextcloud的config.php文件,注意磁盘上可能还会有其他应用程序的config.php文件,别编辑错了。

vim /mnt/FiveOO/opt/wwwroot/Nextcloud/config/config.php

2、在arraydatadirectory之间添加以下文本:

'memcache.local' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => 'localhost',
'port' => 6379,

可以看这个图,更加直观

为了获得更佳的性能,'memcache.locking' => '\OC\Memcache\Redis',这段也建议用上,可将redis用于文件的锁定。

3、保存并退出后,回到网页,刷新页面,看到下面的界面说明配置成功。

没有了需要配置内存缓存的警告,舒服多了,而且网站的性能也能得到提升,美滋滋


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK