nextcloud缺少插件和权限不足问题解决

本文最后更新于 2024年5月16日。

221021
vscode的ssh插件连接主机后会占用很大内存,使内存占用从0.69G升到1.28G。

nextcloud问题


-   This instance is missing some recommended PHP modules. For improved performance and better compatibility it is highly recommended to install them.
`-   intl`
-   The PHP module "imagick" is not enabled although the theming app is. For favicon generation to work correctly, you need to install and enable this module.

上述两个问题安装intl和imagick并启用即可。
在php的dockerfile中安装


libmagickwand-dev \
    && docker-php-ext-configure intl \
    && docker-php-ext-install intl \
   
&& pecl install imagick-beta \
    && echo "extension=imagick.so" > /usr/local/etc/php/conf.d/imagick.ini \
    && pecl clear-cache \
There are some errors regarding your setup.
-   Your web server is not yet properly set up to allow file synchronization, because the WebDAV interface seems to be broken.
-   SQLite is currently being used as the backend database. For larger installations we recommend that you switch to a different database backend. This is particularly recommended when using the desktop client for file synchronisation. To migrate to another database use the command line tool: "occ db:convert-type", or see the [documentation ↗](https://docs.nextcloud.com/server/25/go.php?to=admin-db-conversion).
-   The "X-Content-Type-Options" HTTP header is not set to "nosniff". This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.
-   The "X-Robots-Tag" HTTP header is not set to "none". This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.
-   The "X-Permitted-Cross-Domain-Policies" HTTP header is not set to "none". This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.
-   Your web server is not properly set up to resolve "/.well-known/caldav". Further information can be found in the [documentation ↗](https://docs.nextcloud.com/server/25/go.php?to=admin-setup-well-known-URL).
-   Your web server is not properly set up to resolve "/.well-known/carddav". Further information can be found in the [documentation ↗](https://docs.nextcloud.com/server/25/go.php?to=admin-setup-well-known-URL).
-   You have not set or verified your email server configuration, yet. Please head over to the [Basic settings](https://index.weiyoun.com/index.php/settings/admin) in order to set them. Afterwards, use the "Send email" button below the form to verify your settings.
-   Your installation has no default phone region set. This is required to validate phone numbers in the profile settings without a country code. To allow numbers without a country code, please add "default_phone_region" with the respective [ISO 3166-1 code ↗](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) of the region to your config file.
-   No memory cache has been configured. To enhance performance, please configure a memcache, if available. Further information can be found in the [documentation ↗](https://docs.nextcloud.com/server/25/go.php?to=admin-performance).
-   Your PHP does not have FreeType support, resulting in breakage of profile pictures and the settings interface.
-   This instance is missing some recommended PHP modules. For improved performance and better compatibility it is highly recommended to install them.
`-   intl`
-   The PHP module "imagick" is not enabled although the theming app is. For favicon generation to work correctly, you need to install and enable this module.
-   The PHP modules "gmp" and/or "bcmath" are not enabled. If you use WebAuthn passwordless authentication, these modules are required.
Please double check the [installation guides ↗](https://docs.nextcloud.com/server/25/go.php?to=admin-install), and check for any errors or warnings in the [log](https://index.weiyoun.com/index.php/settings/admin/logging).
Check the security of your Nextcloud over [our security scan ↗](https://scan.nextcloud.com/).

chmod -R 777

wget https://download.nextcloud.com/server/installer/setup-nextcloud.php
wget https://download.nextcloud.com/server/releases/nextcloud-25.0.0.zip

groupadd: invalid group ID ‘www-data’

useradd www-data
groupadd -g  www-data

[root@iZ8vbajg9wo8iwynfb1lgeZ dc3]# ll /var/lib/docker/volumes/dc3_nginxHtml/_data/nextcloud/data
total 1768
drwxr-xr-x 7 admin admin      76 Oct 19 17:34 appdata_oce2rdwbysv7
drwxr-xr-x 2 admin admin      27 Oct 19 17:34 files_external
-rw-r--r-- 1 admin admin       0 Oct 19 17:33 index.html
-rw-r----- 1 admin admin  243580 Oct 19 18:04 nextcloud.log
-rw-r--r-- 1 admin admin 1417216 Oct 19 18:04 owncloud.db
drwxr-xr-x 3 admin admin      19 Oct 19 17:33 weiyoun
[root@iZ8vbajg9wo8iwynfb1lgeZ dc3]#

220922
data文件夹权限错误:

# nextcloud
## Error
-   Your data directory is readable by other users.
Please change the permissions to 0770 so that the directory cannot be listed by other users.
[Nextcloud](https://nextcloud.com/) – a safe home for all your data

解决办法,将

/home/nginx-html/nextcloud/app/lib/private/legacy/OC_Util.php

 $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
}

注释掉
增加

if ($config->getSystemValue('checkdatadirectorypermissions', true)) {
$errors = array_merge( $errors, self::checkDataDirectoryPermissions( $CONFIG_DATADIRECTORY ) );
}

然后在config.php中增加

'checkdatadirectorypermissions' => false

跳过权限检查

cd /home/admin/compose_nextcloud
docker-compose up -d
docker-compose restart

在docker的LNMP环境中安装nextcloud配置好ngingx访问出现内部错误,

查看php日志发现是无法创建log文件。

php      | NOTICE: PHP message: {"reqId":"vW2yWDIr4BYkTdeKWwKF","level":3,"time":"2022-09-21T02:47:46+00:00","remoteAddr":"101.39.212.228","user":"--","app":"PHP","method":"GET","url":"/index.php/apps/photos/service-worker.js","message":"fopen(/var/www/html/nextcloud/app/data/nextcloud.log): Failed to open stream: No such file or directory at /var/www/html/nextcloud/app/lib/private/Log/File.php#84","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36","version":"","data":{"app":"PHP"}}

给相应文件夹应有的权限即可。

cd /root/nginx-html/nextcloud/app
chmod -R 777 ./

报如下错误,少php扩展

## Error
-   PHP module zip not installed.
Please ask your server administrator to install the module.
-   PHP module GD not installed.
Please ask your server administrator to install the module.
-   PHP modules have been installed, but they are still listed as missing?
Please ask your server administrator to restart the web server.

php的dockerfile增加扩展重新build