How To Set Up WebDAV With Lighttpd On Debian Etch

Version 1.0
Author: Falko Timme

This guide explains how to set up WebDAV with lighttpd on a Debian Etch server. WebDAV stands for Web-based Distributed Authoring and Versioning and is a set of extensions to the HTTP protocol that allow users to directly edit files on the lighttpd server so that they do not need to be downloaded/uploaded via FTP. Of course, WebDAV can also be used to upload and download files.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I'm using a Debian Etch server with the IP address 192.168.0.100 here.

 

2 Installing WebDAV

You can install lighttpd (if it's not already installed), the lighttpd WebDAV module and the apache2-utils package (which contains the tool htpasswd which we will need later on to generate a password file for the WebDAV share) as follows:

apt-get install lighttpd lighttpd-mod-webdav apache2-utils

Afterwards, create the directory /var/run/lighttpd and make it owned by the www-data user and group. This directory will contain an SQLite database needed by WebDAV:

mkdir /var/run/lighttpd/
chown www-data:www-data /var/run/lighttpd/

Next, we enable the module mod_auth:

lighty-enable-mod auth

... and open /etc/lighttpd/lighttpd.conf to make sure that the modules mod_alias and mod_webdav are enabled in the server.modules stanza:

vi /etc/lighttpd/lighttpd.conf

[...]
server.modules              = (
            "mod_access",
            "mod_alias",
            "mod_accesslog",
#           "mod_rewrite",
#           "mod_redirect",
#           "mod_status",
#           "mod_evhost",
#           "mod_compress",
#           "mod_usertrack",
#           "mod_rrdtool",
            "mod_webdav",
#           "mod_expire",
#           "mod_flv_streaming",
#           "mod_evasive"
 )
[...]

Restart lighttpd afterwards:

/etc/init.d/lighttpd restart

 

3 Creating A Virtual Host

I will now create a lighttpd vhost (www.example.com) in the directory /var/www/web1/web. If you already have a vhost for which you'd like to enable WebDAV, you must adjust this tutorial to your situation.

First, we create the directory /var/www/web1/web and make the lighttpd user (www-data) the owner of that directory:

mkdir -p /var/www/web1/web
chown www-data:www-data /var/www/web1/web

Then we open /etc/lighttpd/lighttpd.conf and add the following vhost to the end of the file:

vi /etc/lighttpd/lighttpd.conf

[...]
$HTTP["host"] == "www.example.com" {
  server.document-root = "/var/www/web1/web"
}

Afterwards we restart lighttpd:

/etc/init.d/lighttpd restart

Falko Timme

About Falko Timme

Falko Timme is an experienced Linux administrator and founder of Timme Hosting, a leading nginx business hosting company in Germany. He is one of the most active authors on HowtoForge since 2005 and one of the core developers of ISPConfig since 2000. He has also contributed to the O'Reilly book "Linux System Administration".

Share this page:

Suggested articles

0 Comment(s)

Add comment

Comments

By: Falko Timme