Post

Setup Webdav using Caddy

Install Caddy Server

Please see this link https://caddyserver.com/docs/install

Install Caddy Webdav module

1
2
sudo caddy add-package github.com/mholt/caddy-webdav
sudo systemctl restart caddy

Configuring Caddy

First, you should create a new hash password

1
2
caddy hash-password
# example: the "testtest" hash password is "$2a$14$zzWDbY.LBf6W20cg1aJMcurvj2YWAUEUevN5GA/bhVFXsUG5IrzbG"

Then, set the Caddyfile

1
sudo vim /etc/caddy/Caddyfile
1
2
3
4
5
6
7
8
9
10
11
12
13
# configure webdav module
{
    order webdav before file_server
}

# set up webdav for the webdav.example.com host
webdav.example.com {
    root * /data/webdav
    basicauth {
        user $2a$14$zzWDbY.LBf6W20cg1aJMcurvj2YWAUEUevN5GA/bhVFXsUG5IrzbG
    }
    webdav
}

then restart the Caddy

1
systemctl restart caddy

You can use “user and testtest” login in the webdav service “webdav.example.com”

This post is licensed under CC BY 4.0 by the author.