通过不被信任的域名访问

问题:

nextcloud使用IP访问时通过不被信任的域名访问
请联系您的管理员。如果您就是管理员,请参照 config.sample.php 中的示例编辑 config/config.php 中的“trusted_domains”设置。

解决方案:

修改配置文件

配置文件位于下述位置,记得进入指定位置查看。

nextcloud/config/config.php    配置文件位置
/var/www/html/config/config.php    使用docekr部署的
./nextcloud/config/config.php    本地映射

在配置文件中找到下述代码(推荐进入容器使用nano编辑)

'trusted_domains' =>
array (
  0 => 'localhost',
),

添加你要访问的ip或者域名,如下所示

'trusted_domains' =>
array (
  0 => 'localhost',
  1 => '192.168.1.10',
  2 => 'cloud.example.com',
),

重启容器

docker restart nextcloud-app

其他问题

问题:在使用docker.desktop直接修改配置文件遇到下述报错。

遇到这个错误无法写入 “config” 目录!

通常可以为 Web 服务器授予对 config 目录的写入权限来修复这个问题。 但是,如果您更希望将 config.php 文件设为只读,可以将 “config_is_read_only” 选项设置为 true。 查看 https://docs.nextcloud.com/server/29/go.php?to=admin-config

解决方案:

进入容器,记得下述容器名替换为自己的。

docker exec -it nextcloud-app bash

修复config目录权限(配置文件未映射到本地目录)

chown -R www-data:www-data /var/www/html/config
chmod -R 755 /var/www/html/config

重启容器

docker restart nextcloud-app

参考链接:

https://haojie.cn/archives/3.html

https://hellodk.cn/post/598

https://www.vcfan.cn/posts/231217nextcloud%E6%8F%90%E7%A4%BA%E5%9F%9F%E5%90%8D%E9%97%AE%E9%A2%98%E5%A6%82%E4%BD%95%E8%A7%A3%E5%86%B3

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注