“WebDAV (Web Distributed Authoring and Versioning) is an extension of the Hypertext Transfer Protocol (HTTP) that allows clients to perform remote Web content authoring operations. WebDAV is defined in RFC 4918 by a working group of the Internet Engineering Task Force.” - From Wikipedia

goals:

  • setup nginx
  • secure connection
## install packages
> pkg_add nginx
## generate self signed certificates
> openssl req -x509 -nodes -subj "/C=XX/ST=XX/L=XX/O=XX/OU=XX/CN=XX" \
		-newkey rsa:4096 -keyout /etc/ssl/nginx.key \
		-out /etc/ssl/nginx.crt -days 365
## create bcrypt .htpasswd basic
> htpasswd -B -c /etc/nginx/.htpasswd username
## or
> printf "username:`openssl passwd -apr1`\n" >> /etc/nginx/.htpasswd
## edit /etc/nginx/sites-available/default
server {
        listen   443 ssl;
        listen [::]:443 ssl;

        ssl_certificate /etc/ssl/nginx.crt;
        ssl_certificate_key /etc/ssl/nginx.key;

        root /mnt/drive/webdav;

        server_name 10.0.0.4;

        location / {
                dav_methods     PUT DELETE MKCOL COPY MOVE;
                dav_ext_methods   PROPFIND OPTIONS;
                dav_access    user:rw group:rw all:rw;

				auth_basic "restricted";
				auth_basic_user_file /etc/nginx/.htpasswd;

                autoindex     on;
        }
}

just restart nginx and test connection with cadaver or kodi

to use on kodi you have to disable certificate check
append following to the URL |verifypeer=false
like webdavs://10.0.0.4/some-directory/|verifypeer=false