lighttpd

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 - apk add apache2-utils (for htdigest password management) Create WebDAV directory - mkdir -p /var/www/webdav

Configuration for WebDAV

Set WebDAV directory ownership -

# chown lighttpd:lighttpd /var/www/webdav && chmod 755 /var/www/webdav

Create log directory -

# mkdir -p /var/log/lighttpd && chown lighttpd:lighttpd /var/log/lighttpd

Create run directory -

# mkdir -p /var/run/lighttpd && 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"  => "basic",
        "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 alpine (enter password when prompted)

Set password file permissions -

chmod 600 /etc/lighttpd/webdav.passwd && 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

© Prabu Anand K 2020-2026