This page was last modified: May 19 2007 19:28:10   
Too Cool for Internet Explorer

Apache2/WebDAV

The Apache DAV module is an easy way of sharing files. I use it because I was tired of having all my pictures and documents on my laptop, without any possibility to reach them from other computers.

In /usr/local/eth/apache2/httpd.conf, uncomment these lines:

LoadModule dav_module libexec/apache2/mod_dav.so
LoadModule dav_fs_module libexec/apache2/mod_dav_fs.so

Create a webdav directory to test if it works. You can use an existing virtual host, or create a new one. Put these lines into the virtual host:

<VirtualHost *>
  ... other vhost stuff here
  <Directory /usr/local/www/example.tld/webdav>
    DAV on
  </Directory>
</VirtualHost>

Then restart Apache.

You should now be able to open this directory with a webdav client of some sort (most file manager applications can do this). Just supply the URL of your webdav host and add/update files directly.

I use Fedora on my laptop. When connecting to my webdav server, I use the "Connect to server" function from within the File Browser (aka file manager).

At this time, everything you put in your webdav directory, is available to the whole wide world for reading and writing... in most cases, that is not desireable. Therefore you should add some authentication:

<VirtualHost */>
  ... other vhost stuff here
  <Directory /usr/local/www/example.tld/webdav>
    DAV on
    AuthType Basic
    AuthName "WebDAV Storage"
    AuthUserFile /usr/local/www/secure_folder/passwd.dav
    require valid-user
  </Directory>
</VirtualHost>

In Password protection using a password file you can see how to create the password file (AuthUserFile).

It is also a very good idea to use SSL on the connection if you are sending passwords in clear text (AuthType Basic).

About webdav and WinXP: I really don't like to mention MS applikations in my tutorials - I try hard to pretent they don't even exist, but the sad reality is, that many of us struggle every day with MS users.
I was pulling my hair out trying to figure out why I could not connect to my webdav server from Windows XP. It turned out that XP refuses to show any content on a none-SSL connection (isn't it amazing how MS products seem to always know what is best for you *sigh*).

The client can open the files directly, edit at save them directly on the server. Be aware that windows explorer will not let you open common webfiles like *.txt, *.html, *.gif and *.jpg. If you double-click such a file through windows explorer, they will open in internet explorer. But just copy them to a local directory, and replace them when you're done editing. If you or your users have been wise enough to choose another operationg system for your clients, this will not be a problem :-)

The webserver must of course have both read and write permission to the files in the webdav folder.

www.webdav.org