dokcer部署nextcloud
官网 https://nextcloud.com/
github https://github.com/chrootLogin/docker-nextcloud
客户端 https://nextcloud.com/install/#install-clients
网络拓扑
nextcloud主机---路由器---光猫---互联网---<公网用户访问
|
---<内网用户直接访问
容器安装
#rm -rf /home/Nextcloud
mkdir -p /home/Nextcloud/{apps,data,theme,config}
docker pull nextcloud
docker run -itd --restart=always --net=host -p 81:80--name nextcloud \
-v /home/Nextcloud:/var/www/html \
-v /home/Nextcloud/apps:/var/www/html/custom_apps \
-v /home/Nextcloud/config:/var/www/html/config \
-v /home/Nextcloud/data:/var/www/html/data \
nextcloud
网页继续安装
浏览器访问ip:81 ,完成后续安装过程
选择使用mysql报错未解决,我选择的是sqlite
登录访问
浏览器访问ip:81,输入账号密码进入如下页面
配置nginx使用https代理
安装nginx,参考https://www.cnblogs.com/tangshow/p/16184765.html
nginx配置如下:
server {
listen 5502 ssl;
server_name x.com;
ssl_certificate /etc/nginx/conf.d/x.pem; # managed by Certbot
ssl_certificate_key /etc/nginx/conf.d/x.key; # managed by Certbot
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
add_header Strict-Transport-Security "max-age=15768000";
client_max_body_size 3024M; #上传大文件改大
location / {
proxy_pass http://127.0.0.1:80/;
proxy_set_header Host $host:5502;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 300;
}
}
重载nginx
进入容器
doocker exec -it nextcloud /bin/bash
apt-get update
apt-get install vim -y
修改nextcloud配置
添加:
'overwriteprotocol' => 'https',
#不加会导致手机app无法访问
添加:
array (
0 => 'localhost',
1 => '个人的域名',
),
# 允许通过这些ip域名来访问
修改后即可正常使用