11

解决 nextcloud 通过不被信任的域名访问 问题

 2 years ago
source link: https://hellodk.cn/post/598
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 通过不被信任的域名访问 问题

前置条件:本文讨论的是通过docker安装的nextcloud。如果是直接在宿主机上安装,那么改好配置文件不需要重启容器。

这个问题很好解决,进入到容器,docker exec -it nextcloud bash 然后修改这个文件 /var/www/html/config/config.php

然后修改 trusted_domains 字段

下面两种语法都可以,将新的域名追加到数组后

'trusted_domains' =>
array (
0 => '1.1.1.1:8013',
1 => 'cloud.hellodk.cn',
'trusted_domains' =>
'demo.example.org',
'otherdomain.example.org',
'10.111.112.113',
'[2001:db8::1]'

上面两种语法都可以,注意一下这两种写法最后一个元素的后面是否可以加逗号,第一种可以而第二种不可以,目前 config.sample.php 中使用的是第二种语法方案,更推荐使用这种。我遇到的问题就是改好了重启 nextcloud 容器不生效,后面发现是我写成了 https://cloud.hellodk.cn

保存退出,exit 退出容器回到宿主机,然后执行 docker restart nextcloud 重启nextcloud容器就可以了。

注意,写成下面这样是错误的

'trusted_domains' =>
array (
0 => '1.1.1.1:8013',
1 => 'https://cloud.hellodk.cn',

ps: 以上ip+port 是虚构的


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK