eqwreyrt
Preliminary Note
I’m using a Debian Lenny 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:
aptitude install lighttpd lighttpd-mod-webdav apache2-utils
Afterwards, we must make sure that the directory /var/run/lighttpd is owned by the www-data user and group. This directory will contain an SQLite database needed by WebDAV:
chown www-data:www-data /var/run/lighttpd/
Next, we enable the modules mod_auth and mod_webdav:
lighty-enable-mod auth
lighty-enable-mod webdav
Reload lighttpd afterwards:
/etc/init.d/lighttpd force-reload
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
4 Configure The Virtual Host For WebDAV
(My sample lighttpd.conf)
Now we create the WebDAV password file /var/www/web1/passwd.dav with the user test (the -c switch creates the file if it does not exist):
htpasswd -c /var/www/web1/passwd.dav test
You will be asked to type in a password for the user test.
(Please don't use the -c switch if /var/www/web1/passwd.dav is already existing because this will recreate the file from scratch, meaning you lose all users in that file!)
Now we change the permissions of the /var/www/web1/passwd.dav file so that only root and the members of the www-data group can access it:
chown root:www-data /var/www/web1/passwd.dav
chmod 640 /var/www/web1/passwd.dav
Now we modify our vhost in /etc/lighttpd/lighttpd.conf so that it looks as follows:
vi /etc/lighttpd/lighttpd.conf
$HTTP["host"] == "www.example.com" {
- 19.07.2010 überschrift blabla
You can find older weblog entries in the archive.



