lighttpd
Table of Contents
lighttpd server is running on a Alpine Linux image in the oci AMD VM instance.
Installation
Update system packages and Install lighttpd with modules
doas apk update && apk upgrade doas apk add lighttpd lighttpd-mod_webdav
Install apache2-utils for htdigest password management and created WebDAV directory -
mkdir -p /var/www/webdav
Configuration for WebDAV
Set WebDAV directory ownership -
doas chown lighttpd:lighttpd /var/www/webdav && doas chmod 755 /var/www/webdav
Create log directory -
doas mkdir -p /var/log/lighttpd && doas chown lighttpd:lighttpd /var/log/lighttpd
Create run directory -
doas mkdir -p /var/run/lighttpd && doas chown lighttpd:lighttpd /var/run/lighttpd
Edit lighttpd configuration -
$ doas cp /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.bak $ doas vi /etc/lighttpd/lighttpd.conf
Ensure the file appears as follows:
$ cat /etc/lighttpd/lighttpd.conf server.modules = ( "mod_webdav", "mod_dirlisting", "mod_authn_file", "mod_auth", "mod_accesslog" ) server.document-root = "/var/www/webdav" server.port = 8080 server.username = "lighttpd" server.groupname = "lighttpd" server.pid-file = "/run/lighttpd.pid" webdav.activate = "enable" webdav.is-readonly = "disable" dir-listing.activate = "enable" # Authentication #auth.backend = "plain" #auth.backend.plain.userfile = "/etc/lighttpd/webdav.passwd" auth.backend = "htdigest" auth.backend.htdigest.userfile = "/etc/lighttpd/webdav.passwd" auth.require = ( "/" => ( "method" => "digest", "realm" => "webdav", "require" => "valid-user" ) ) # Log Configuration server.errorlog = "/var/log/lighttpd/error.log" accesslog.filename = "/var/log/lighttpd/access.log"
Create htdigest password file
doas htdigest -c /etc/lighttpd/webdav.passwd webdav [username] (enter password when prompted)
Set password file permissions -
doas chmod 600 /etc/lighttpd/webdav.passwd && doas chown lighttpd:lighttpd /etc/lighttpd/webdav.passwd
Test configuration -
lighttpd -t -f /etc/lighttpd/lighttpd.conf (verify syntax)
Start lighttpd service and Enable on boot and then Verify service status
doas rc-service lighttpd start doas rc-update add lighttpd default rc-service lighttpd status && netstat -tlnp | grep 8080