Personal tools
You are here: Home Complex Instructions Web and Email Setting Up DAV on Apache 2

Setting Up DAV on Apache 2

Instructions for setting up WebDAV on Apache 2 on a Debian server. I would imagine that these instructions would work on any Apache 2 installation with slight modifications.

These instructions assume that Apache 2 is already installed and functioning.  They borrow generously from the official Apache docs.  DAV provides read/write access through Apache, much like FTP.  I use it to host shared .ics calendar files.

The first thing we need to do is enable the DAV module.  To do this, add the following three symbolic links:

ln -s /etc/apache2/mods-available/dav_fs.load /etc/apache2/mods-enabled/dav_fs.load
ln -s /etc/apache2/mods-available/dav.load /etc/apache2/mods-enabled/dav.load
ln -s /etc/apache2/mods-available/dav_lock.load /etc/apache2/mods-enabled/dav_lock.load

Now edit the sites-enabled file (located under /etc/apache2/sites-enabled) and add the following information under the VirtualHost in question.

DavLockDB /var/lock/apache2/DavLock

<Directory /var/www/foo>
     Order Allow,Deny
     Allow from all

     Dav On
     AuthType Basic
     AuthName bar
     AuthUserFile /etc/apache2/htaccess/bar
     Require valid-user
</Directory>

This allows read/write DAV access to the directory /var/www/foo.  Before people can access this DAV folder, they must type the username and password contained in the htaccess file located at /etc/apache2/htaccess/bar.

Now that we have the settings configures, we need to create the folder /etc/apache2/htaccess.  Then run the following command to create the htaccess file:

htpasswd -c /etc/apache2/htaccess/bar username

The system will ask you to type the password you want twice for the username you have specified.

Restart Apache and everything should be ready to go.

Document Actions