|
Docker 搭建 Nextcloud的问题解答
Q&A
1. "Strict-Transport-Security" HTTP 头未设为至少 "15552000" 秒。为了提高安全性,建议启用 HSTS
本人开启了 Cloudflare CDN, 因此才做下方操作, 否者应该是编写 Nginx 配置, 这里是因为 Cloudflare CDN 重写了响应头
实测成功解决
2. 你正通过安全连接访问你的实例,然而你的实例正生成不安全的 URL
参考:
https://docs.nextcloud.com/server/23/admin_manual/configuration_server/reverse_proxy_configuration.html
https://www.cnblogs.com/mouseleo/p/15516828.html
- 'trusted_domains' =>
- array (
- 0 => 'nextcloud.moeci.com',
- ),
- 'overwriteprotocol' => 'https',
复制代码
实测成功, 无需重启,刷新页面发现即刻生效
现在还可以发现所有 相关 URL 已经替换为 https
3. 您的网页服务器未正确设置以解析“/.well-known/caldav”
参考:
Reverse proxy — Nextcloud latest Administration Manual latest documentation
General troubleshooting — Nextcloud latest Administration Manual latest documentation
TODO: 经过测试, 下方未成功解决, 依然有上方提示
nginx.conf
- location /.well-known/carddav {
- return 301 $scheme://$host/remote.php/dav;
- }
- location /.well-known/caldav {
- return 301 $scheme://$host/remote.php/dav;
- }
复制代码
补充
注意: 不使用 https, 无法登录 安卓app
经过实测, 不对 Nextcloud 服务端 使用 https, 无法使用 安卓app 登录, 注意: Nextcloud 服务端内部需要使用 https, 即需 解决 Q&A: 1,2
Nginx: location ~ /
- # proxy to 8001
- location ~ / {
- proxy_pass http://localhost:8001;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_set_header REMOTE-HOST $remote_addr;
- add_header X-Cache $upstream_cache_status;
- # cache
- add_header Cache-Control no-cache;
- expires 12h;
- # websocket support
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- }
复制代码
使用 location ~ / 当匹配上 / 时,就不会再向下搜索其它匹配规则了, 而 使用 location / 则会尝试向下搜索其它匹配规则
其他解答请点击:https://cloud.tencent.com/developer/article/1976612
|