How To Set Up WebDAV With Lighttpd On Fedora 9

Version 1.0
Author: Falko Timme

This guide explains how to set up WebDAV with lighttpd on a Fedora 9 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 Fedora 9 server with the IP address 192.168.0.100 here.

 

2 Installing WebDAV

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

yum install lighttpd httpd-tools

Then we create the system startup links for lighttpd (so that lighttpd starts automatically whenever the system boots) and start it:

chkconfig --levels 235 lighttpd on
/etc/init.d/lighttpd start

Next, we open /etc/lighttpd/lighttpd.conf and enable/add the modules mod_alias, mod_webdav, and mod_auth in the server.modules stanza (it is important that mod_webdav is listed before mod_auth!):

vi /etc/lighttpd/lighttpd.conf
[...]
server.modules              = (
#                               "mod_rewrite",
#                               "mod_redirect",
                                "mod_alias",
                                "mod_access",
#                               "mod_cml",
#                               "mod_trigger_b4_dl",
                                "mod_webdav",
                                "mod_auth",
#                               "mod_status",
#                               "mod_setenv",
#                               "mod_fastcgi",
#                               "mod_proxy",
#                               "mod_simple_vhost",
#                               "mod_evhost",
#                               "mod_userdir",
#                               "mod_cgi",
#                               "mod_compress",
#                               "mod_ssi",
#                               "mod_usertrack",
#                               "mod_expire",
#                               "mod_secdownload",
#                               "mod_rrdtool",
                                "mod_accesslog" )
[...]

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 and group (lighttpd) the owner of that directory:

mkdir -p /var/www/web1/web
chown lighttpd:lighttpd /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
Share this page:

0 Comment(s)