webdav 定义
WebDAV协议为用户在服务器上创建、更改和移动文档提供了一个框架。WebDAV协议最重要的功能包括维护作者或修改日期的属性、名字空间管理、集合和覆盖保护。维护属性包括创建、删除和查询文件信息等。名字空间管理处理在服务器名称空间内复制和移动网页的能力。集合(Collections)处理各种资源的创建、删除和列举。覆盖保护处理与锁定文件相关的方面。
部署方式
- 新建一个
docker-compose.yml
文件,记得替换username和password两个变量:
version: '3'
services:
rclone-webdav-server:
container_name: rclone-webdav-server
image: rclone/rclone
command:
# Tweak here rclone's command line switches:
# - "--config"
# - "/path/to/mounted/rclone.conf"
- "--verbose"
- "serve"
- "webdav"
- "/data"
- "--user"
- "${username}"
- "--pass"
- "${password}"
# - "remote:/"
- "--addr"
- "0.0.0.0:8080"
# - "--read-only"
# - "--no-modtime"
# - "--no-checksum"
restart: unless-stopped
# Use host networking for simplicity.
# It also enables server's default listen on 127.0.0.1 to work safely.
# net: host
# If you want to use port mapping instead of host networking,
# make sure to make rclone listen on 0.0.0.0.
ports:
- "0.0.0.0:8085:8080"
# Here you have to map your host's rclone.conf directory to
# container's /root/.config/rclone/ dir (R/O).
# If you have any remote referencing local files, you have to
# map them here, too.
volumes:
- ./config/:/root/.config/rclone/:ro
- ./data/:/data
- 执行
docker-compose up -d
启动rclone
服务 - 注册一个
cloudflare
账号,进入choudflare
的控制面板,并注册一个现有域名或者在cloudflare买一个域名 - 点击进入
zero trust
- 点击Access->Tunnels,然后新建一个tunnel如果没有的话
- 点击进入编辑tunnel,复制tunnel的token,
- 执行如下命令
docker run -d --restart=always --name=cloudflared cloudflare/cloudflared:latest tunnel --no-autoupdate run --token ${token}
- 进入tunnel的
public hostname
,添加你自己的子域名,在更多配置里面把Disable Chunked Encoding
设置为开启 - 保存
- 浏览器打开你配置的域名看看是否已经可以浏览文件目录
- 用webDAV客户端连接看看是否可以连接上