刚刚把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后出现的一些新的警告提示已全部消灭干净