nextcloud 使用过程中遇到的问题及解决方案

nextcloud 使用过程中遇到的问题及解决方案

1.nextcloud 中文乱码问题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
这里改成这样,就可以解决txt中文乱码问题(测试之后确实可以,但是为导致整个系统样式错乱)
/**
* @param IOutput $output
* @since 11.0.0
*/
public function callback(IOutput $output) {
if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) {
$output->setHeader('Content-Length: ' . $this->file->getSize());
//$output->setOutput($this->file->getContent());
$fileContents=$this->file->getContent();
$encoding = mb_detect_encoding($fileContents . "a", "UTF-8,GB2312, GBK, WINDOWS-1252, ISO-8859-15, ISO-8859-1, ASCII", true);
if ($encoding === "") {
$encoding = "ISO-8859-15";
}
$fileContents = iconv($encoding, "UTF-8", $fileContents);
$output->setOutput($fileContents);
}
}

2.nextcloud删除文件失败解决

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
1. nextcloud 出问题(文件锁住了)  基本用第二步就可以了
解决方法:
进入维护模式
$ sudo -u www-data php occ maintenance:mode --on
连接数据库,清空 oc_file_locks表;
关闭维护模式。
$ sudo -u www-data php occ maintenance:mode --off
2. redis 把文件锁住了(这次是这种情况,上传文件时,重启了php、nginx服务)
日志如下:
"Exception":"OCP\\Lock\\LockedException","Message":"\"files/d7261a487db8162b2346d8228516cf33\" is locked, existing lock on file: 5 shared
解决方法如下,清空整个 Redis 服务器的数据(删除所有数据库的所有 key )

yxh@yxhserver:/home/nextcloud$ redis-cli
127.0.0.1:6379> FLUSHALL
OK
127.0.0.1:6379> exit

3.nextcloud优化

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
1. redis 优化
redis已经安装成功
vi /var/www/html/nextcloud/config/config.php

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

测试:
在终端上使用redis-cli命令进入redis控制台,使用keys * 命令来显示是否有值插入redis之中。

2.修改PHP内存限制
vi /etc/php.ini
将memory_limit=128M修改为memory_limit=512M

重启
systemctl restart httpd.service

nextcloud 使用过程中遇到的问题及解决方案
http://example.com/2023/08/08/nextcloud 使用过程中遇到的问题及解决方案/
作者
zgx
发布于
2023年8月8日
许可协议