配置文件
切换root权限,新建一个nextcloud的文件夹,进入该目录,创建docker-compose.yml
- [cps@localhost ~]$ su root
- Password: 666666
- [root@localhost cps]# ls
- Desktop Documents Downloads Music Pictures Public Templates Videos
- [root@localhost cps]# docker images
- REPOSITORY TAG IMAGE ID CREATED SIZE
- hello-world latest d2c94e258dcb 13 months ago 13.3kB
- centos 7 eeb6ee3f44bd 2 years ago 204MB
- [root@localhost cps]# pwd
- /home/cps
- [root@localhost cps]# mkdir nextcloud
- [root@localhost cps]# cd nextcloud/
- [root@localhost nextcloud]# touch docker-compose.yml
- [root@localhost nextcloud]# gedit docker-compose.yml
复制代码- version: '2.1'
- volumes:
- nextcloud:
- db:
- services:
- db:
- image: mysql
- command: --default-authentication-plugin=mysql_native_password
- restart: always
- volumes:
- - /home/cps/nextcloud/mysql:/var/lib/mysql
- environment:
- - MYSQL_ROOT_PASSWORD=12345678
- - MYSQL_PASSWORD=nextcloud
- - MYSQL_DATABASE=nextcloud
- - MYSQL_USER=nextcloud
-
- app:
- image: nextcloud
- ports:
- - 8008:80
- links:
- - db
- volumes:
- - /home/cps/nextcloud/nextcloud:/var/www/html
复制代码 安装部署
本地访问
http:localhost:8008
Nextcloud设置
等候一会
内网穿透
cpolar安装
- curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
- sudo systemctl enable cpolar
- sudo systemctl start cpolar
复制代码 cpolar登录web
- https://www.cpolar.com/官网注册账号
- cpolar安装成功后,在外部浏览器上访问Linux 的9200端口即:【http://服务器的局域网ip:9200】
- 使用cpolar账号登录,登录后即可看到cpolar web 配置界面,在仪表盘下创建隧道。
配置可信任域名
‘trusted_domains’ => 添加可信任域名5256185a.r1.vip.cpolar.cn
- [root@localhost nextcloud]# find / -name "config.php"
- find: ‘/run/user/1001/gvfs’: Permission denied
- /var/lib/docker/volumes/ad49ff6c8750b8ec4841ac640f8c6b1a4f49fece3a97401bd714d072e1cedda3/_data/config/config.php
- [root@localhost nextcloud]# gedit /var/lib/docker/volumes/ad49ff6c8750b8ec4841ac640f8c6b1a4f49fece3a97401bd714d072e1cedda3/_data/config/config.php
- [root@localhost nextcloud]# cat /var/lib/docker/volumes/ad49ff6c8750b8ec4841ac640f8c6b1a4f49fece3a97401bd714d072e1cedda3/_data/config/config.php
- <?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' => 'ocq23pxvlmom',
- 'passwordsalt' => 'uzZUljuHVuZ8MtsoKF6pljCMUskNwo',
- 'secret' => 'hevqvGaITGj/9zns/PpMJZ2L98xCpl0g6iS76aeB9/1siZpZ',
- 'trusted_domains' =>
- array (
- 0 => 'localhost:8008',
- 1 => '5256185a.r1.vip.cpolar.cn',
- ),
- 'datadirectory' => '/var/www/html/data',
- 'dbtype' => 'mysql',
- 'version' => '23.0.0.10',
- 'overwrite.cli.url' => 'http://localhost:8008',
- 'dbname' => 'nextcloud',
- 'dbhost' => 'db',
- 'dbport' => '',
- 'dbtableprefix' => 'oc_',
- 'mysql.utf8mb4' => true,
- 'dbuser' => 'nextcloud',
- 'dbpassword' => 'nextcloud',
- 'installed' => true,
- );
复制代码 确保docker容器NextCloud、Mysql已开启
- [root@localhost nextcloud]# docker ps
- CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
- 1e9178afddf5 nextcloud "/entrypoint.sh apac…" 2 days ago Up 2 days 0.0.0.0:8008->80/tcp, :::8008->80/tcp nextcloud_app_1
- e504c967c5b5 mysql "docker-entrypoint.s…" 2 days ago Up 2 days 3306/tcp, 33060/tcp nextcloud_db_1
复制代码 公网访问
问题与解决
bash: docker-compose: command not found…
- [root@localhost nextcloud]# docker-compose up -d
- bash: docker-compose: command not found...
复制代码 sudo yum -y install epel-release
- docker-compose依赖python,安装 python-pip 模块
sudo yum install python-pip
wget https://github.com/docker/compose/releases/download/1.14.0-rc2/docker-compose-Linux-x86_64
- 重命名工具 docker-compose 名称,并移动到系统可实行目录
mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose -version
mysql 很多Waiting。。。镜像pull不下来
- vi /etc/docker/daemon.json
复制代码- {
- "registry-mirrors": ["https://studk.mirror.aliyuncs.com","http://f1361db2.m.daocloud.io"]
- }
复制代码- sudo systemctl restart docker
复制代码 通过不被信任的域名访问
- 'trusted_domains' =>
- array (
- 0 => 'localhost',
- 1 => '这里写域名',
- ),
复制代码 参考
我的docker漫笔19:Nextcloud部署
https://juejin.cn/post/6982782635546411015
docker-compose: command not found问题的两种常用方法
https://blog.csdn.net/sinat_17358633/article/details/128764036
容器技能.合版.v0.095.增改.学生版.pdf 【3.3.2 镜像加快】
docker镜像pull不下来终极解决方法
https://www.cnblogs.com/wang50902/p/11378202.html
Docker 配置国内源加快(2023/05/14)
https://blog.csdn.net/qq_44797987/article/details/112681224
docker 报错ERROR: client version 1.22 is too old. Minimum supported API version is 1.24···
https://blog.csdn.net/zwy3327078581/article/details/136037950
如安在Linux系统使用Docker部署Nextcloud网盘并实现随地公网远程访问
https://cloud.tencent.com/developer/article/2392880
Nextcloud通过不被信任的域名访问解决方法 Nextcloud 您正在访问来自不信任域名的服务器
https://blog.51cto.com/u_15296600/3008162
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |