要说什么通用 那就是先有了良好的设计

安装

alipine

1
2
wget https://github.com/hacdias/webdav/releases/download/v5.11.4/linux-amd64-webdav.tar.gz
tar -xvf linux-amd64-webdav.tar.gz

/etc/init.d/webdav

1
2
3
4
5
6
7
8
9
10
11
#!/sbin/openrc-run

name="webdav"
command="/data/webdav"
command_args="-c /data/webdav.yaml"
command_background="yes"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
need net
}
1
2
3
chmod +x /etc/init.d/webdav
rc-service webdav start
rc-update add webdav

配置

/etc/webdav.yaml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
address: 127.0.0.1
port: 6065
tls: false
prefix: /dav
debug: false
noSniff: false
behindProxy: true
directory: .
permissions: R
rules: []
rulesBehavior: overwrite
log:
format: console
colors: true
outputs:
- stderr

cors:
enabled: false

users:
- username: username
password: password
permissions: CRUD
directory: /hdd/path