寶塔面板部署NextCloud(14.0.3)逐一解決後臺安全
方才把NextCloud更新到14.0.3,後臺又出現了一堆警告,也是夠煩的。
之前寫過 寶塔面板安裝NextCloud一一搞定後臺safe及設定警告,這個是基於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方法傳送郵件。
實則就是讓你設定1個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的command行,而nextcloud又是基於owncloud開拓的,因而需要用到OCC來修復喪失的資料庫索引。
修復command為:
php occ db:add-missing-indices
SSH進入伺服器nextcloud的根目錄,並執行修復command
出現如下錯誤
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”. 這會導致資訊洩露
粗心是,需要設定1個Referrer-Policy請求頭來提升safe性。Nginx配置檔案裡增加:
add_header Referrer-Policy "no-referrer";
======================================================
至此,Nextcloudupgrade到14.0.3後出現的一些新的警告提示已全部覆滅徹底
原文連結:https://host.fubi.hk/foreshadowinghost/zhishiku/20181026/8429.html