How to configure WebDAV on Ubuntu 14.04

Add new user for WebDAV

adduser kim

Grant sudo privileges to new user

sudo usermod -aG sudo kim

Install thest latest Apache

sudo apt-get update
sudo apt-get install apache2

Preparing a directory for WebDAV
(Below creates a symbolic link from /etc/apache2/mods-available to /etc/apache2/mods-enabled.)

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

Open or create the configuration file at /etc/apache2/sites-available/000-default.conf

nano /etc/apache2/sites-available/000-default.conf

Add the following in black
(The file DavLock does not need to be created. The directory just need to be writeable by Apache)

DavLockDB /var/www/DavLock
<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  DocumentRoot /var/www/html
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /webdav /var/www/webdav

DAV On

</Directory>

</VirtualHost>

 

Continue if you wish to add authentication

Digest Authentication
To generate the digest file, we have to install the dependencies.

sudo apt-get install apache2-utils

Add a user for WebDAV for Digest authentication

sudo htdigest -c /etc/apache2/users.password webdav kim

Add a second user (without -c flag)

sudo htdigest /etc/apache2/users.password webdav test

Allow Apache to read the password file

sudo chown www-data:www-data /etc/apache2/users.password

Make changes to the configuration at /etc/apache2/sites-available/000-default.conf

....
<Directory /var/www/webdav> DAV On AuthType Digest

AuthName "webdav"

AuthUserFile /etc/apache2/users.password

Require valid-user

</Directory>
</VirtualHost>

Finally, enable the Digest module and restart the server for the settings to take effect

sudo a2enmod auth_digest
sudo service apache2 restart

 

Remember to Uncheck the “Automatically detect settings” on Windows Internet Explorer.

Leave a Comment

Your email address will not be published. Required fields are marked *