nextcloud 安装配置教程

1、容器启动命令
docker run -d -p 5757:80 -v /F/docker/nextcloud:/var/www/html/data  --restart=always  --name nextcloud  nextcloud:latest


docker run -d -p 80:80 -v /mnt/sda3/data/docker/nextcloud:/var/www/html/data  --restart=always  --name nextcloud  nextcloud:latest


docker run -d -p 8088:80 -v /mnt/sda1/opt/docker/nextcloud/apps:/var/www/html/custom_apps -v /mnt/sda1/opt/docker/nextcloud/config:/var/www/html/config -v /mnt/sda1/opt/docker/nextcloud/data:/var/www/html/data -v /mnt/sda1/opt/docker/nextcloud/nextcloud:/var/www/html --restart=always --name nextcloud  arm64v8/nextcloud:latest

2、安装时配置数据库:
docker 容器访问宿主机的mysql的host:
host.docker.internal:3306

docker cp 8052f7620146:/var/www/html/config/config.php /E/software/nextcloud/peizhi/

docker cp /E/software/nextcloud/peizhi/config.php  8052f7620146:/var/www/html/config/


3、nextcloud重置密码
命令:
sudo -u www-data php /var/www/html/occ user:resetpassword admin

如果提示没有找到sudo命令,则使用
apt-get update
apt-get install sudo
安装sudo


4、路由器重启导致机器ip变更问题解决:修配置文件。
配置文件路径/var/www/html/config/config.php
内容:
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  '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' => 'oc5mn3wlqnja',
  'passwordsalt' => 'qe0MZ/GAnSlPQRfcJxSCRZ7h3+iUuY',
  'secret' => 'p32D9lkYjc/vpShmYW3otXaOX74BxJR9v35GIgTkf1nLOEL7',
  'trusted_domains' => 
  array (
    0 => '192.168.1.3:5757',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '26.0.0.11',
  'overwrite.cli.url' => 'http://192.168.1.3:5757',
  'dbname' => 'nextcloud',
  'dbhost' => 'host.docker.internal:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_root',
  'dbpassword' => '.82J]YE=AHx3e#99+lsRg4lb}W.27J',
  'installed' => true,
  'app_install_overwrite' => 
  array (
    0 => 'richdocumentscode',
  ),
  'auth.bruteforce.protection.enabled' => false,
);

在trusted_domains中修改成对应的ip即可;
再设置 config.php权限:chmod 777 /var/www/html/config/config.php

5、更换文件存储路径
原路径映射是:/E/docker/nextcloud:/var/www/html/data
修改后的路径映射是:/F/docker/nextcloud:/var/www/html/data
步骤:
(1)删除原容器;
(2)重新启动容器,命令:docker run -d -p 5757:80 -v /F/docker/nextcloud:/var/www/html/data  --restart=always  --name nextcloud  nextcloud:latest
(3)浏览器打开http://localhost:5757,按提示安装,数据库配置信息必须和之前容器配置保持一致;
(4)安装成功后,将/E/docker/nextcloud目录下的用户数据复制到F/docker/nextcloud目录下即可;


6、错误:nextcloud 您的数据目录可被其他用户读取 请更改权限为 0770 以避免其他用户查看目录
    解决办法:config.php 添加 ‘check_data_directory_permissions’ => false

你可能感兴趣的:(nextcloud,docker)