| 
 
| Nextcloud作为可个人使用的私有云,不但功能方面非常强大,而且搭建却特别的简单,只要有vps,搭好php+mysql环境,就可以使用了。 
 Nextcloud除了网页版可以快速使用,还有iOS和Android的客户端,再加上还有WebDAV功能,很多文件管理App都可以添加WebDAV来进行便捷操作。
 
 搭建好Nextcloud,可以参考 Nextcloud安全设置及文件配置 进行服务器级别的优化,还可以修改Nextcloud的配置文件config.php来进行进阶优化。
 
 下面给出config.php文件的完整中文对照,大家可以按需开启功能。
 
 
 复制代码<?php
$CONFIG = array(
  'instanceid' => '',    #安装 ID, 在安装时自动设定, 更改会出导致 NextCloud 无法访问
  'passwordsalt' => '',    #用于加密密码, 更改后会导致无法登陆
  'secret' => '',    #用于加密传输等
  'trusted_domains' => array (                #域名
    0 => 'blog.haitianhome.com',
  ),
  'datadirectory' => '/home/wwwroot/data',                #NextCloud 数据放置目录
  'version' => '16.0.4.1',                #版本号
  /* 数据库信息 */
  'dbtype' => 'mysql',                #数据库类型
  'dbhost' => 'localhost',                #数据库服务器
  'dbname' => '',                #数据库名
  'dbuser' => '',                #数据库用户名
  'dbpassword' => '',                #数据库密码
  'dbtableprefix' => 'oc_',                #数据库前缀
  'installed' => True,                #是否安装
  'default_language' => 'za',                #默认语言
  'defaultapp' => 'files',                #默认 APP
  'knowledgebaseenabled' => true,                #在用户菜单中添加帮助选项
  'allow_user_to_change_display_name' => False,                #是否允许用户改变显示昵称
  'remember_login_cookie_lifetime' => 60*60*24*15,                #登录 Cookie 保留时间
  'session_lifetime' => 60 * 60 * 24,                #Session 保留时间
  'session_keepalive' => true,                #保持 Session 活跃
  'token_auth_enforced' => false,                #强制开启客户端验证
  'auth.bruteforce.protection.enabled' => true,                #强力保护
  'skeletondirectory' => '/home/wwwroot/file/core/skeleton',                #skeleton 目录
  'user_backends' => array(
      array(
              'class' => 'OC_User_IMAP',                #可选 : IMAP (OC_User_IMAP), SMB 
(OC_User_SMB), and FTP (OC_User_FTP)
              'arguments' => array('{imap.gmail.com:993/imap/ssl}INBOX')
      )
  ),
  'lost_password_link' => 'https://blog.haitianhome.com/forgot',                #忘记密码链接
  /* 邮箱服务器信息 */
  'mail_domain' => 'haitianhome.com',                #发送邮箱域名
  'mail_from_address' => 'admin',                #发送邮箱用户
  'mail_smtpdebug' => false,                #SMTP Debug
  'mail_smtpmode' => 'php',                #发送模式, 可选 : sendmail、smtp、qmail、php
  'mail_smtphost' => '127.0.0.1',                #邮件服务器
  'mail_smtpport' => 25,                #邮件服务器端口
  'mail_smtptimeout' => 10,                #超时设定, 单位 : 秒
  'mail_smtpsecure' => '',                #安全模式, 可选 : ssl、tls
  'mail_smtpauth' => false,                #验证
  'mail_smtpauthtype' => 'LOGIN',                #验证模式, 可选 : LOGIN、PLAIN
  'mail_smtpname' => '',                #验证用户名
  'mail_smtppassword' => '',                #验证密码
  /* Proxy */
  'overwritehost' => '',                #重写地址
  'overwriteprotocol' => '',                #协议, 可选 : HTTP、HTTPS
  'overwritewebroot' => '',                #重写根目录
  'overwritecondaddr' => '',                #IP 地址重写, 支持正则表达式
  'overwrite.cli.url' => '',                #制定 URL
  'htaccess.RewriteBase' => '/',                #htaccess 重写
  'htaccess.IgnoreFrontController' => false,                #如果 Apache 没有启用 "mov_env", 则启用此项
  'proxy' => '',                #代理服务器
  'proxyuserpwd' => '',                #代理服务器验证
  'trashbin_retention_obligation' => '7, 30',                #垃圾箱选项, 保留 D1 天, 在 D2 天删
除. 设定为 auto 则为 30天删除. 可选项 : auto、D, auto、auto, D、D1, D2、disabled
  'versions_retention_obligation' => '30, 180',                #文件版本保留, 可选项同上
  'appcodechecker' => true,                #检测 APP 是否使用私有 API
  'updatechecker' => true,                #更新检测
  'updater.server.url' => 'https://updates.nextcloud.com/updater_server/',                #更新检测
服务器
  'updater.release.channel' => 'stable',                #更新选项, 可选 : daily、beta、stable、
production
  'has_internet_connection' => true,                #是否有网路链接
  'check_for_working_webdav' => true,                #验证 working WebDAV 的连通性
  'check_for_working_wellknown_setup' => true,                #验证 working .well-known URL 重定
向
  'check_for_working_htaccess' => true,                #检测 .htaccess 文件可写性
  'config_is_read_only' => false,                #配置文件权限
  'log_type' => 'file',                #日志文件类型
  'logfile' => '/var/log/nextcloud.log',                #日志文件保存路径
  'loglevel' => 0,                #日志等级, 可选 : 0 = Debug, 1 = Info, 2 = Warning, 3 = Error, and 
4 = Fatal
  'syslog_tag' => 'Nextcloud',                #
  'log.condition' => [
          'shared_secret' => '57b58edb6637fe3059b3595cf9c41b9',
       'users' => ['sample-user'],
      'apps' => ['files'],
  ],
  'logdateformat' => 'l, d-M-Y H:i:s T',                #日期类型
  'logtimezone' => 'Asia/Hong_Kong',                #时间区域
  'log_query' => false,                #多服务器日志
  'cron_log' => true,                #cron 日志
  'log_rotate_size' => false,                #日志文件大小限制
  'customclient_desktop' =>                #桌面客户端链接
      'https://nextcloud.com/install/#install-clients',
  'customclient_android' =>                #Android 客户端链接
      'https://play.google.com/store/apps/details?id=com.nextcloud.client',
  'customclient_ios' =>                #iOS 客户端链接
      'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8',
  'appstoreenabled' => true,                #NextCloud App Store
  'apps_paths' => array(                #APP 路径
      array(
               'path'=> '/home/www/file/apps',
              'url' => '/apps',
              'writable' => true,
      ),
  ),
  'enable_previews' => true,                #开启文件预览
  'preview_max_x' => 2048,                #最大宽度
  'preview_max_y' => 2048,                #最大高度
  'preview_max_scale_factor' => 10,                #模糊系数
  'preview_max_filesize_image' => 50,                #预览图片最大大小
  /*'preview_libreoffice_path' => '/usr/local/libreoffice',                #libreoffice 预览配置
  'preview_office_cl_parameters' =>
          ' --headless --nologo --nofirststartwizard --invisible --norestore '.
          '--convert-to pdf --outdir ',*/
  'enabledPreviewProviders' => array(                #可预览文件后缀
          'OC\\Preview\\PNG',
          'OC\\Preview\\JPEG',
          'OC\\Preview\\GIF',
          'OC\\Preview\\BMP',
          'OC\\Preview\\XBitmap',
          'OC\\Preview\\MP3',
          'OC\\Preview\\TXT',
          'OC\\Preview\\MarkDown',
    'OC\\Preview\\Movie',
    'OC\\Preview\\MSOfficeDoc',
    'OC\\Preview\\MSOffice2003',
    'OC\\Preview\\MSOffice2007',
    'OC\\Preview\\OpenDocument',
    'OC\\Preview\\StarOffice',
    'OC\\Preview\\Illustrator',
    'OC\\Preview\\PDF',
    'OC\\Preview\\Photoshop',
    'OC\\Preview\\Postscript',
    'OC\\Preview\\SVG',
    'OC\\Preview\\TIFF',
    'OC\\Preview\\Font'
  ),
  'ldapUserCleanupInterval' => 51,                #检查用户后台作业时间间隔, 单位 : 分
  'comments.managerFactory' => 'OC\\Comments\\ManagerFactory',                #Comments 
Manager Factory
  'systemtags.managerFactory' => 'OC\\SystemTag\\ManagerFactory',                #SystemTag 
Manager Factory
  'mail_template_class' => 'OC\\Mail\\EMailTemplate',                #邮件模板
  'maintenance' => false,                #维护模式
  /**'openssl' => array(                #OpenSSL
          'config' => '/absolute/location/of/openssl.cnf',
  ),**/
  'memcache.local' => 'OC\\Memcache\\APCu',                #Memcached
  'memcache.distributed' => 'OC\\Memcache\\Memcached',
  'redis' => [                #Redis
          'host' => 'localhost', #Redis 服务器
          'port' => 6379,                #Redis 端口
          'timeout' => 0.0,                #Redis 超时设定
          'password' => '7p^*F}7nMYX^N=ufP]vVU)u27JDXiii8Hd4Mq2P8RAPxLg)WxCUT,2#9pRmvsxrZ',                
#Redis 密码
          'dbindex' => 1,                #Redis 数据库选择
  ],
  'memcached_servers' => array(                #Memcached 服务器
          array('localhost', 11211),
  ),
  'memcached_options' => array(                #Memcached 选项
          \Memcached::OPT_CONNECT_TIMEOUT => 50,
          \Memcached::OPT_RETRY_TIMEOUT =>   50,
          \Memcached::OPT_SEND_TIMEOUT =>    50,
          \Memcached::OPT_RECV_TIMEOUT =>    50,
          \Memcached::OPT_POLL_TIMEOUT =>    50,
          \Memcached::OPT_COMPRESSION =>          true,
          \Memcached::OPT_LIBKETAMA_COMPATIBLE => true,
          \Memcached::OPT_BINARY_PROTOCOL =>      true,
  ),
  'cache_path' => '/wwwroot/file/data/$user/cache',                #缓存目录
  'cache_chunk_gc_ttl' => 60*60*24,                #缓存删除时间
  /*'objectstore' => [                #Object Store 模式
          'class' => 'OC\\Files\\ObjectStore\\Swift',
          'arguments' => [
                  // trystack will use your facebook id as the user name
                  'username' => 'jonny0201',
                  // in the trystack dashboard go to user -> settings -> API Password to
                  // generate a password
                  'password' => 'Secr3tPaSSWoRdt7',
                  // must already exist in the objectstore, name can be different
                  'container' => 'nextcloud',
                  // prefix to prepend to the fileid, default is 'oid:urn:'
                  'objectPrefix' => 'oid:urn:',
                  // create the container if it does not exist. default is false
                  'autocreate' => true,
                  // required, dev-/trystack defaults to 'RegionOne'
                  'region' => 'RegionOne',
                  // The Identity / Keystone endpoint
                  'url' => 'http://8.21.28.222:5000/v2.0',
                  // required on dev-/trystack
                  'tenantName' => 'facebook100000123456789',
                  // dev-/trystack uses swift by default, the lib defaults to 'cloudFiles'
                  // if omitted
                  'serviceName' => 'swift',
                  // The Interface / url Type, optional
                  'urlType' => 'internal'
          ],
  ],*/
  'sharing.managerFactory' => 'OC\\Share20\\ProviderFactory',                #Share Provider 
Factory
  'sharing.maxAutocompleteResults' => 7,                #用户搜索最大返回数
  'sharing.minSearchStringLength' => 0,                #搜索最小长度
  /*'dbdriveroptions' => array(                #MySQL SSL
          PDO::MYSQL_ATTR_SSL_CA => '/file/path/to/ca_cert.pem',
          PDO::MYSQL_ATTR_INIT_COMMAND => 'SET wait_timeout = 28800'
  ),*/
  #'sqlite.journal_mode' => 'DELETE',                #SQLite journal 模式
  'mysql.utf8mb4' => false,
  'supportedDatabases' => array(                #支持的数据库
          'sqlite',
          'mysql',
          'pgsql',
          'oci',
  ),
  'tempdirectory' => '/tmp/nextcloudtemp',                #Temp 文件夹
  'hashingCost' => 10,                #加密数值
  #'blacklisted_files' => array('.htaccess'),                #禁止列表
  'share_folder' => '/',                #默认分享文件夹
  'theme' => '',                #主题
  'cipher' => 'chacha20',                #加密方式
  'minimum.supported.desktop.version' => '2.17.8',                #最小桌面客户端版本
  'quota_include_external_storage' => false,                #外部存储
  'filesystem_check_changes' => 1,                #文件系统更改检测
  'part_file_in_storage' => true,                #上传时切割
  'mount_file' => '/www/file/data/mount.json',                #mount.json 路径
  'filesystem_cache_readonly' => false,                #文件缓存只读
  #'trusted_proxies' => array('203.0.113.45', '198.51.100.128'),                #信任的 Proxy 服务
器列表
  'forwarded_for_headers' => array('HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR'),                #转发
  'max_filesize_animated_gifs_public_sharing' => -1,                #动态图片 gif 预览最大大小, 单位 :MB
  'filelocking.enabled' => true,                #文件协作
  'filelocking.ttl' => 60*60,                #文件协作锁定时间, 单位 : 秒
  'memcache.locking' => 'OC\\Memcache\\Redis',                #文件协作缓存方式
  'filelocking.debug' => false,                #文件写作 Debug 模式
  'upgrade.disable-web' => false,                #基于 Web 的更新程序
  'debug' => false,                #Debug 模式
  'data-fingerprint' => '',                #备份确认
  'copied_sample_config' => false,                #默认配置确认
  #'lookup_server' => 'https://lookup.nextcloud.com',                #自定义查询服务器
  'gs.enabled' => false,                #Nextcloud's Global Scale
  'gs.federation' => 'internal',                #内部使用 Nextcloud's Global Scale
);
?>
 
 | 
 |