官网文档很多示例是采用ubantu配置,没有centos或者apache或者php操作或者对linux不太了解的慎入,因为部署起来到外网采用https访问包括网盘自身检测机制的各种报错,日志报错等都很让人难受或者无奈!
几个注意项(需要改动):
/var/www/html/nextcloud/config/config.php
<?php$CONFIG = array ('secret' => '$','trusted_domains' =>array (0 => '10.10.10.5',1 => '$',),'overwrite.cli.url' => '$','memcache.local' => '\OC\Memcache\APCu','memcache.locking' => '\OC\Memcache\Redis','redis' => ['host' => 'localhost','port' => 6379,],);// $ 表示改动项,根据实际改动,部分我的配置已删除,含有隐私信息
find / -name occ#/var/www/html/nextcloud/occ #查找到occ地址,另外centos8是apache用户,不是www-datasudo -u apache php /var/www/html/nextcloud/occ db:add-missing-indices
2021.8.2 nextcloud-22
CentOS Linux release 8.4.2105

<?php$CONFIG = array ('instanceid' => 'xxx','passwordsalt' => 'xxx','secret' => 'xxx','trusted_domains' =>array (0 => '127.0.0.1',1 => '域名',),'datadirectory' => '/var/www/html/nextcloud/data','dbtype' => 'mysql','version' => '22.0.0.11','overwrite.cli.url' => 'https://域名/','memcache.local' => '\OC\Memcache\APCu','dbname' => 'nextcloud','dbhost' => 'localhost','dbport' => '','dbtableprefix' => 'oc_','mysql.utf8mb4' => true,'dbuser' => 'nextcloud','dbpassword' => '密码','installed' => true,'default_phone_region' => 'CN', //解决Nextcloud提示“您的安装没有设置默认的电话区域”);
关闭url中的index.php
- config.php中添加一条
'htaccess.RewriteBase' => '/', - 然后控制台输入如下命令(centos是Apache用户,非www-data)

*/5 * * * * php -f /var/www/html/nextcloud/cron.php
