Support Online
Skip to main content

What is WebDAV and what does it do?

WebDAV is an extension of the HTTP protocol.
It offers the opportunity to read, write and edit files on the remote server.

Advantages

  • No additional client software required
  • Compatible with Windows, macOS and Linux
  • Secure with HTTPS and Digest Auth

Prerequisites

The following should be ready:

  • Server with Ubuntu 20.04 installed
  • sudo authorized user
  • Apache Virtual Host connected to the domain
  • Let's Encrypt SSL certificate
  • Domain name (example: ornek.com)

Enabling Apache WebDAV Modules

This step activates WebDAV functions.

sudo a2enmod dav

This command enables the WebDAV kernel module.

sudo a2enmod dav_fs

This command turns on file system support.

sudo systemctl restart apache2

Apache is restarted.

Preparing WebDAV Directories

1. Create the main directory where the files will be kept:

sudo mkdir /var/www/webdav

2. Make the Apache user the directory owner:

sudo chown www-data:www-data /var/www/webdav

3. Create secure directory for WebDAV lock database:

sudo mkdir -p /usr/local/apache/var
sudo chown www-data:www-data /usr/local/apache/var

This directory should not be accessible via the web.

Apache Virtual Host Configuration

1. Open the SSL configuration file:

sudo nano /etc/apache2/sites-enabled/ornek.com-le-ssl.conf

2. Add at the top of the file:

DavLockDB /usr/local/apache/var/DavLock

3. Add inside the VirtualHost block:

Alias /webdav /var/www/webdav

<Directory /var/www/webdav>
DAV On
</Directory>

4. Test the configuration:

sudo apachectl configtest

If there is no problem, restart Apache.

sudo systemctl restart apache2

Digest Auth is more secure than Basic Auth.

1. Create the password file

sudo touch /usr/local/apache/var/users.password
sudo chown www-data:www-data /usr/local/apache/var/users.password

2. Add WebDAV user

sudo htdigest /usr/local/apache/var/users.password webdav genixnode_kullanici

You will be asked to enter a password.

3. Open the Virtual Host file again:

sudo nano /etc/apache2/sites-enabled/ornek.com-le-ssl.conf

4. Update the Directory block:

<Directory /var/www/webdav>
DAV On
AuthType Digest
AuthName "webdav"
AuthUserFile /usr/local/apache/var/users.password
Require valid-user
</Directory>

5. Activate the required module:

sudo a2enmod auth_digest

6. Restart Apache:

sudo systemctl restart apache2

Testing WebDAV Access

1. Create test file:

sudo nano /var/www/webdav/test.txt
sudo chown www-data:www-data /var/www/webdav/test.txt
  • Link Addresses:
Sistem URL
Linux (KDE) webdavs://ornek.com/webdav
Linux (GNOME) davs://ornek.com/webdav
macOS https://ornek.com/webdav
Windows https://ornek.com/webdav

Use the user you created when logging in.

Frequently Asked Questions

Why is WebDAV preferred?

No additional software required and supported by all major operating systems.

Why is Digest Auth more secure?

The password is not sent directly, its hash (digest) value is used.

What does DavLockDB do?

Prevents simultaneous editing conflicts on the same file.

Is HTTPS mandatory?

Yes. WebDAV must be used with SSL / HTTPS.

Result

A secure WebDAV server is now running on Apache. You can manage your files centrally.

You can try it now on the GenixNode platform.