宝塔面板部署NextCloud(14.0.3)逐一解决后台安全及设置警告

Linux, PHP 2018/10/22

刚刚把NextCloud更新到14.0.3,后台又出现了一堆警告,也是够烦的。

之前写过 宝塔面板部署NextCloud逐一解决后台安全及设置警告,那个是基于Nextcloud 13.x的,所以就再补充记录一下解决如下的警告。

Use of the the built in php mailer is no longer supported. Please update your email server settings
您的网页服务器未正确设置以解析“/.well-known/caldav”
您的网页服务器未正确设置以解析“/.well-known/carddav”
The database is missing some indexes. Due to the fact that adding indexes on big tables could take some time they were not added automatically. By running “occ db:add-missing-indices” those missing indexes could be added manually while the instance keeps running. Once the indexes are added queries to those tables are usually much faster.
在数据表 “oc_share” 中无法找到索引 “parent_index” .
在数据表 “oc_filecache” 中无法找到索引 “fs_mtime” .
HTTP的请求头 “Referrer-Policy” 未设置为 “no-referrer”, “no-referrer-when-downgrade”, “strict-origin” or “strict-origin-when-cross-origin”. 这会导致信息泄露. 请查阅 W3C 建议

1.Use of the the built in php mailer is no longer supported. Please update your email server settings

大意就是php自带的mail组件不再被nextcloud支持,需要使用smtp方式发送邮件。

其实就是让你设置一个smtp服务器信息,便于发送邮件,关于SMTP这里不再详述。

2.您的网页服务器未正确设置以解析“/.well-known/caldav”及您的网页服务器未正确设置以解析“/.well-known/carddav”

这两个警告可以一起解决,出现该提示一般是因为这两个路径的伪静态设置有问题,导致无法正常访问。

解决方法就是添加两行重定向配置

rewrite /.well-known/carddav /remote.php/dav permanent;
rewrite /.well-known/caldav /remote.php/dav permanent;

3.The database is missing some indexes. Due to the fact that adding indexes on big tables could take some time they were not added automatically. By running “occ db:add-missing-indices” those missing indexes could be added manually while the instance keeps running. Once the indexes are added queries to those tables are usually much faster.

在数据表”oc_share” 中无法找到索引”parent_index”
在数据表”oc_filecache” 中无法找到索引”fs_mtime”

大意是说,数据库的一些索引丢失了,需要使用OCC修复一下。OCC是owncloud的命令行,而nextcloud又是基于owncloud开发的,所以需要用到OCC来修复丢失的数据库索引。

修复命令为:

php occ db:add-missing-indices

SSH进入服务器nextcloud的根目录,并执行修复命令

出现如下错误

Console has to be executed with the user that owns the file config/config.php
Current user: root
Owner of config.php: www
Try adding ‘sudo -u www ‘ to the beginning of the command (without the single quotes)

好吧,需要使用www用户权限来修改,再次执行

sudo -u www php occ db:add-missing-indices

修复成功!

4.HTTP的请求头 “Referrer-Policy” 未设置为 “no-referrer”, “no-referrer-when-downgrade”, “strict-origin” or “strict-origin-when-cross-origin”. 这会导致信息泄露

大意是,需要设置一个Referrer-Policy请求头来提高安全性。Nginx配置文件里添加:

add_header Referrer-Policy "no-referrer";

======================================================

至此,Nextcloud升级到14.0.3后出现的一些新的警告提示已全部消灭干净

本文标签:


20条评论

  • jeforce 评论于 回复

    你好,nginx环境搭建了nextcloud 21.0.0,出现了问题,尝试了几种方法,都没有解决,大佬,能麻烦你给个解决方案吗?

    关于您的设置有一些警告。
    您的网页服务器未正确设置以解析“/.well-known/webfinger”。更多信息请参见文档。
    您的网页服务器未正确设置以解析“/.well-known/nodeinfo”。更多信息请参见文档。

  • xiaoming 评论于 回复

    小皮面板0.4 nexcloud18.0.2
    sudo -u www php occ db:add-missing-indices
    /usr/local/phpstudy/soft/php/php-7.3.8/bin/php: error while loading shared libraries: libnsl.so.1: cannot open shared object file: No such file or directory

  • 友人 评论于 回复

    大佬 15.0.7出现新问题了0.0麻烦研究下啊,
    宝塔+MYsql5.6
    所使用的数据库为MySQL但没有对4字节字符的支持。为正确处理文件名或评论中使用的4字节字符(比如emoji表情),建议开启MySQL的4字节字符支持。详细信息请阅读相关文档页面。

  • 友人 评论于 回复

    关于您的网页服务器未正确设置以解析“/.well-known/caldav”及您的网页服务器未正确设置以解析“/.well-known/carddav”
    这个问题,如何在阿里云 全站加速怎么解决,在Nginx配置输入无效。
    求大佬看看

  • 7lsu 评论于 回复

    大大 外部储存显示
    “smbclient” 未安装。无法挂载 “SMB / CIFS”, “SMB / CIFS 使用 OC 登录信息”。请联系管理员安装。
    这个问题怎么解决啊
    现在执行pecl install smbclient也报错:
    WARNING: channel “pecl.php.net” has updated its protocols, use “pecl channel-update pecl.php.net” to update
    Could not download from “https://pecl.php.net/get/smbclient-1.0.0.tgz”, cannot download “pecl/smbclient” (Connection to `ssl://pecl.php.net:443′ failed: )
    Error: cannot download “pecl/smbclient”
    Download failed
    install failed

    • Bug侠 评论于 回复

      @7lsu
      呃~这个我还没遇到过,不过你可以尝试按它的提示操作一下啊。
      比如它说需要使用“pecl channel-update pecl.php.net”进行升级什么的

  • zxyer 评论于 回复

    按照你的教程改完后 警告都消除了 :咧嘴: 但是更麻烦的问题来了 各种js和css报404错误 :笑哭:

    • Bug侠 评论于 回复

      @zxyer
      那可能是你哪里没设置好哟,部署了很多次nextcloud了,都没问题的,再检查检查~

      • zxyer 评论于 回复

        @Bug侠
        嗯嗯,我把nextcloud删除重新安装一遍 再按你的教程弄一遍又好了。。。

        • Bug侠 评论于 回复

          @zxyer
          所以可能是在部署过程中出现了什么问题,弄好了就行 :大笑:

  • 弦夕 评论于 回复

    并且目前有两个问题,到官方社区也没有找到答案。
    AMH面板,Apache2.4,php7.2,mysql5.6.
    安装的Nextcloud14.0.3,但是nextcloud的安卓手机APP无法登陆。
    提示“访问已失败:Operation finished with HTTP status code 401(fail)

    还有一个就是用宝塔面板测试的时候可以上传中文命名的文件,不管是歌曲还是图片,中文名字是可以正常上传的。
    但是我用AMH面板就就出现了无法上传中文命名的文件。上传的时候也出现上传进度,那个进度条就是一划而过,然后没任何反应,也没有上传文件。
    很奇怪。。。

    不知道能不能请大侠赐教。

    我的QQ:xxxxx
    感谢,感谢,感谢。
    可以付费,谢谢,谢谢。

    • Bug侠 评论于 回复

      @弦夕
      1.http 401问题:表示认证错误,估计和你的用户名和密码有关系,有没有特殊字符?或者通过修改用户名(包括密码)来排查。
      2.上传问题:可能是AMH的web上传组件(一般是前端)有问题,可以简单排查,比如:你可以尝试上传英文文件名的文件,如果AMH可以上传,那就很有可能是AMH的前端bug,可以通过chrome的控制台console检查是不是前端js出错了。
      ===========
      顺便提一句,AMH确实是有点过时了……

  • 弦夕 评论于 回复

    您好,HTTP的请求头 “Referrer-Policy” 未设置为 “no-referrer这个问题,
    如果web服务器是Apache的话,怎么修改呢?
    万分感谢。

    • Bug侠 评论于 回复

      @弦夕
      Apache我没怎么研究过,一直用的Nginx,不过应该可以这样添加配置:
      ———-
      Header always set Referrer-Policy “same-origin”
      ———-
      参考:https://serverfault.com/questions/880894/how-can-i-add-in-apache-referrer-policy-header

  • 友人 评论于 回复

    大佬你的服务器是在国外吧

    • Bug侠 评论于 回复

      @友人
      对,阿里云新加坡

    评论(本站已开启评论回复邮件通知功能,请如实填写邮箱以便及时收到回复)关闭回复