webdav 下载地址:
https://github.com/hacdias/webdav/releases

解压

tar -zxvf linux-amd64-webdav.tar.gz

复制到 /usr/bin 目录下:

cp webdav /usr/bin/

注册 service

cat <<EOF > /etc/systemd/system/webdav.service
[Unit]
Description=WebDAV server
After=network.target

[Service]
Type=simple
User=root
ExecStart=/usr/bin/webdav --config /etc/webdav/config.yaml
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF

建立配置文件,和上面 /etc/systemd/system/webdav.service 里的 ExecStart 目录要对应上
mkdir /etc/webdav/
cd /etc/webdav/

cat <<EOF > ./config.yaml
address: 0.0.0.0
port: 10001
auth: true
tls: false
cert: cert.pem
key: key.pem

scope: .
modify: true
rules: []
users:
  - username: admin
    password: admin
    scope: /webdav
EOF

开机并启动服务

systemctl enable webdav
systemctl start webdav

查看运行状态

systemctl status webdav