Skip to content

WebDAV โ€‹

Store backups on any WebDAV-compatible server โ€” Nextcloud, ownCloud, Apache, Nginx, or any other WebDAV endpoint.

Overview โ€‹

WebDAV (Web Distributed Authoring and Versioning) is an extension of HTTP that allows clients to manage files on remote servers. Benefits:

  • ๐ŸŒ Works over HTTP/HTTPS โ€” no special ports or protocols
  • ๐Ÿ”’ HTTPS encryption in transit by default
  • ๐Ÿ“ Native support in Nextcloud, ownCloud, Synology, and many NAS devices
  • ๐Ÿ”‘ Simple username/password authentication

Configuration โ€‹

FieldDescriptionDefault
NameFriendly nameRequired
URLWebDAV server URLRequired
UsernameWebDAV usernameRequired
PasswordWebDAV passwordOptional
Path PrefixSubdirectory for backupsOptional

Setup Examples โ€‹

Nextcloud โ€‹

  1. Ensure WebDAV is enabled (it is by default)
  2. Create a dedicated user or use an existing account
  3. Configure in DBackup:
    • URL: https://nextcloud.example.com/remote.php/dav/files/USERNAME/
    • Username: backupuser
    • Password: Your password or an app password
    • Path Prefix: backups/server1

App Passwords

For security, create a dedicated app password in Nextcloud under Settings > Security > App passwords instead of using your main password.

ownCloud โ€‹

  1. WebDAV is enabled by default
  2. Configure in DBackup:
    • URL: https://owncloud.example.com/remote.php/dav/files/USERNAME/
    • Username: backupuser
    • Password: Your password
    • Path Prefix: backups

Synology NAS (WebDAV) โ€‹

  1. Install the WebDAV Server package from Package Center
  2. Enable HTTPS in WebDAV Server > Settings
  3. Configure in DBackup:
    • URL: https://synology-ip:5006
    • Username: backupuser
    • Password: Your password
    • Path Prefix: backups

Apache (mod_dav) โ€‹

  1. Enable modules: a2enmod dav dav_fs
  2. Configure a WebDAV directory in your Apache config:
apache
<Directory /var/www/webdav>
    Dav On
    AuthType Basic
    AuthName "WebDAV"
    AuthUserFile /etc/apache2/.htpasswd
    Require valid-user
</Directory>
  1. Create the htpasswd file: htpasswd -c /etc/apache2/.htpasswd backupuser
  2. Restart Apache: sudo systemctl restart apache2
  3. Configure in DBackup:
    • URL: https://server.example.com/webdav
    • Username: backupuser
    • Password: Your htpasswd password

Nginx (nginx-dav-ext-module) โ€‹

  1. Install Nginx with DAV support
  2. Add a WebDAV location block:
nginx
location /webdav {
    alias /var/www/webdav;
    dav_methods PUT DELETE MKCOL COPY MOVE;
    dav_ext_methods PROPFIND OPTIONS;
    dav_access user:rw group:rw all:r;

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

    create_full_put_path on;
    autoindex on;
}
  1. Create htpasswd: htpasswd -c /etc/nginx/.htpasswd backupuser
  2. Restart Nginx: sudo systemctl restart nginx
  3. Configure in DBackup:
    • URL: https://server.example.com/webdav
    • Username: backupuser
    • Password: Your htpasswd password

Directory Structure โ€‹

After backups, your WebDAV server will contain:

/your-prefix/
โ”œโ”€โ”€ mysql-daily/
โ”‚   โ”œโ”€โ”€ backup_2024-01-15T12-00-00.sql.gz
โ”‚   โ”œโ”€โ”€ backup_2024-01-15T12-00-00.sql.gz.meta.json
โ”‚   โ””โ”€โ”€ ...
โ””โ”€โ”€ postgres-weekly/
    โ””โ”€โ”€ ...

Docker Configuration โ€‹

The WebDAV adapter uses the webdav npm package and requires no additional system dependencies. It works out of the box in both Docker and local development environments.

Troubleshooting โ€‹

Connection Failed โ€‹

401 Unauthorized

Solutions:

  1. Verify username and password are correct
  2. For Nextcloud/ownCloud, try using an app password
  3. Ensure the WebDAV endpoint URL is correct

Forbidden โ€‹

403 Forbidden

Solutions:

  1. Check file/folder permissions on the server
  2. Verify the user has write access to the target directory
  3. Check if server-side security rules (e.g., fail2ban) are blocking requests

Not Found โ€‹

404 Not Found

Solutions:

  1. Verify the WebDAV URL is correct
  2. For Nextcloud: ensure URL includes /remote.php/dav/files/USERNAME/
  3. Check that the WebDAV service is enabled on the server

SSL Certificate Errors โ€‹

UNABLE_TO_VERIFY_LEAF_SIGNATURE

Solutions:

  1. Use a valid SSL certificate (e.g., Let's Encrypt)
  2. For self-signed certificates in development, set NODE_TLS_REJECT_UNAUTHORIZED=0 (not recommended for production)

File Size Limits โ€‹

Some WebDAV servers impose upload size limits:

Solutions:

  1. Apache: Increase LimitRequestBody directive
  2. Nginx: Increase client_max_body_size directive
  3. Nextcloud: Adjust upload_max_filesize and post_max_size in PHP config

Security Best Practices โ€‹

  1. Use HTTPS โ€” Always use TLS-encrypted connections
  2. App passwords โ€” Use dedicated app passwords instead of main account passwords
  3. Dedicated user โ€” Create a separate account for backups with minimal permissions
  4. Path isolation โ€” Restrict the backup user to a specific directory
  5. Firewall rules โ€” Limit which IPs can access the WebDAV endpoint
  6. Enable backup encryption โ€” Use DBackup's encryption profiles for at-rest encryption

Comparison with Other Destinations โ€‹

FeatureWebDAVSFTPSMBS3Local
Setup complexityEasyMediumEasyEasyEasiest
Works over internetโœ…โœ…โŒโœ…โŒ
HTTPS encryptionโœ…N/A (SSH)โŒโœ…N/A
Nextcloud/ownCloudโœ…โŒโŒโŒโŒ
NAS supportโœ…โœ…โœ…โŒโŒ
Self-hostedโœ…โœ…โœ…โŒโœ…
No CLI dependencyโœ…โœ…โŒโœ…โœ…

Next Steps โ€‹

Released under the GNU General Public License. | Privacy ยท Legal Notice