任意问题解决大招:https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html
基于docker安装完nextcloud会提示一下错误,安全检查事项
#数据库丢失了一些索引。由于给大的数据表添加索引会耗费一些时间,因此程序没有自动对其进行修复。您可以在 Nextcloud 运行时通过命令行手动执行 “occ db:add-missing-indices” 命令修复丢失的索引。索引修复后会大大提高相应表的查询速度。 docker exec -u www-data -i nextcloud_app_1 php occ db:add-missing-indices #此实例中的 php-imagick 模块不支持 SVG。为了获得更好的兼容性,建议安装它。 docker exec -i nextcloud_app_1 apt update && docker exec -i nextcloud_app_1 apt install imagemagick #INVALID_HASH: core/js/mimetypelist.js in the list of invalid files docker exec -i nextcloud_app_1 cp -av /usr/src/nextcloud/core/js/mimetypelist.js core/js/ #您的网页服务器未正确设置以解析“/.well-known/caldav”。更多信息请参见文档。 #您的网页服务器未正确设置以解析“/.well-known/carddav”。更多信息请参见文档。 #在nginx代理中添加 location = /.well-known/carddav { return 301 https://网盘域名:443/remote.php/dav; } location = /.well-known/caldav { return 301 https://网盘域名:443/remote.php/dav; } location = /.well-known/host-meta { return 301 https://网盘域名:443/public.php?service=host-meta; } location = /.well-known/host-meta.json { return 301 https://网盘域名:443/public.php?service=host-meta-json; } location = /.well-known/webfinger { return 301 https://网盘域名:443/index.php/.well-known/webfinger; } location = /.well-known/nodeinfo { return 301 https://网盘域名:443/index.php/.well-known/nodeinfo; } #如果是apache服务器,编辑/etc/apache2/sites-available/000-default.conf,增加下列 <Directory /> Options FollowSymLinks AllowOverride All Order deny,allow Deny from all </Directory> <Directory "/var/www/html"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny Allow from all </Directory>
解决视频不显示缩略图
#安装ffmpeg sudo apt-get install ffmpeg ghostscript sudo service apache2 restart #配置文件中增加 'enabledPreviewProviders' => array ( 0 => 'OC\\Preview\\PNG', 1 => 'OC\\Preview\\JPEG', 2 => 'OC\\Preview\\GIF', 3 => 'OC\\Preview\\HEIC', 4 => 'OC\\Preview\\BMP', 5 => 'OC\\Preview\\XBitmap', 6 => 'OC\\Preview\\MP3', 7 => 'OC\\Preview\\TXT', 8 => 'OC\\Preview\\MarkDown', 9 => 'OC\\Preview\\Movie', 9 => 'OC\\Preview\\PDF', 9 => 'OC\\Preview\\MP4', ),
做完上述配置发现PDF缩略图还是没有显示成功
#通过日志发现pdf在做转换的时候出发了权限问题:ImagickException: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/421****** #编辑Imagick的配置文件 vi /etc/ImageMagick-6/policy.xml ''' <!-- disable ghostscript format types --> <policy domain="coder" rights="read|write" pattern="PS" /> <policy domain="coder" rights="read|write" pattern="PS2" /> <policy domain="coder" rights="read|write" pattern="PS3" /> <policy domain="coder" rights="read|write" pattern="EPS" /> <policy domain="coder" rights="read|write" pattern="PDF" /> <policy domain="coder" rights="read|write" pattern="XPS" /> ''' #重启apache2服务 /etc/init.d/apache2 restart
nextcloud无法访问应用商店
#在使用中某些拉胯网络无法访问官方源,导致应用商店加载不出来 使用APP商店国内镜像 镜像地址:https://www.orcy.net/ncapps/v1/ github链接加速代理的镜像:https://www.orcy.net/ncapps/v2/ #在config.php中增加以下配置 'appstoreenabled' => true, 'appstoreurl' => 'https://www.orcy.net/ncapps/v2/',
设置默认语言和默认时区
'default_language' => 'zh_CN', 'default_locale' => 'zh',
使用redis缓存提高效率
#配置好redis,使用下列配置即可,如果有其他问题全力排查redis故障 'memcache.local' => '\\OC\\Memcache\\redis', 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => [ 'host' => '1.1.1.1', 'port' => 6379, 'dbindex' => 0, 'password' => 'xxxxxx', 'timeout' => 1.5, ], #php优化配置 redis.session.locking_enabled=1 redis.session.lock_retries=-1 redis.session.lock_wait_time=10000
nextcloud基于curl下载share文件
#基于分享连接实现非交互下载 #如果分享为整个目录 #可参考工具:https://github.com/aertslab/nextcloud_share_url_downloader curl -u "SHARE_ID:SHARE_PASSWORD" -H 'X-Requested-With: XMLHttpRequest' -O "https://urls/public.php/webdav/xxxxxx.tgz" #如果分享为单个文件 curl -u "SHARE_ID:SHARE_PASSWORD" -H 'X-Requested-With: XMLHttpRequest' -o xxxxxx.tgz "https://urls/public.php/webdav/"
nextcloud基于用户使用curl上传下载文件
#基于用户名密码实现非交互上传和下载 #upload curl -X PUT -u yasu:<pass> https://urls/remote.php/dav/files/xxx/ -T ./image.jpg #download curl -X GET -u yasu:<pass> https://urls/remote.php/dav/files/xxx/Nextcloud.png --output Nextcloud.png
服务器上使用mv将文件更新到用户目录
#移动数据到用户目录下 mv bge-m3.tgz /$nextcloud_home/data/zhangsan/files/ #更新文件信息 docker exec -u www-data -i nextcloud_app_1 php occ files:scan --path=zhangsan
nextcloud配置文件config.php全览
<?php $CONFIG = array ( 'htaccess.RewriteBase' => '/', 'memcache.local' => '\\OC\\Memcache\\redis', 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => [ 'host' => '1.1.1.1', 'port' => 6379, 'dbindex' => 0, 'password' => 'xxxxxxxx', 'timeout' => 1.5, ], 'apps_paths' => array ( 0 => array ( 'path' => '/var/www/html/apps', 'url' => '/apps', 'writable' => false, ), 1 => array ( 'path' => '/var/www/html/custom_apps', 'url' => '/custom_apps', 'writable' => true, ), ), 'instanceid' => 'xxxxxgsvdlxg', 'passwordsalt' => 'xxxxxxxxUJTczZLe2hWU/M0t', 'secret' => 'xxxxxxxxxxmZxDgXGv43+rVAFXtL080VS7', 'trusted_domains' => array ( 0 => '192.168.2.181:8080', 1 => 'xxx.xxxxx.com:8443', ), 'datadirectory' => '/var/www/html/data', 'dbtype' => 'mysql', 'version' => '23.0.3.2', 'overwrite.cli.url' => 'http://xxx.xxxxxx.com:8443', 'forcessl' => true, 'overwriteprotocol' => 'https', 'dbname' => 'nextcloud', 'dbhost' => 'db', 'dbport' => '', 'dbtableprefix' => 'oc_', 'mysql.utf8mb4' => true, 'dbuser' => 'nextcloud', 'dbpassword' => 'xxxxxxxx', 'installed' => true, 'mail_smtpmode' => 'smtp', 'mail_sendmailmode' => 'smtp', 'default_language' => 'zh_CN', 'default_locale' => 'zh', 'mail_from_address' => 'xxxx', 'mail_domain' => '126.com', 'mail_smtpauthtype' => 'LOGIN', 'mail_smtpauth' => 1, 'mail_smtphost' => 'smtp.126.com', 'mail_smtpport' => '465', 'mail_smtpname' => 'xxxxxxxxx@126.com', 'mail_smtppassword' => 'Oxxxxxxxxx', 'mail_smtpsecure' => 'ssl', 'enabledPreviewProviders' => array ( 0 => 'OC\\Preview\\PNG', 1 => 'OC\\Preview\\JPEG', 2 => 'OC\\Preview\\GIF', 3 => 'OC\\Preview\\HEIC', 4 => 'OC\\Preview\\BMP', 5 => 'OC\\Preview\\XBitmap', 6 => 'OC\\Preview\\MP3', 7 => 'OC\\Preview\\TXT', 8 => 'OC\\Preview\\MarkDown', 9 => 'OC\\Preview\\Movie', 10 => 'OC\\Preview\\PDF', 11 => 'OC\\Preview\\MP4', ), 'default_phone_region' => 'CN', 'maintenance' => false, 'loglevel' => 0, 'theme' => '', 'appstoreenabled' => true, 'appstoreurl' => 'https://www.orcy.net/ncapps/v2/', );