Steps#
- create lighttpd directory in $HOME
mkdir -p ~/lighttpd/{html,conf.d,passwd} && cd ~/lighttpd
- create index.html
echo Lighttpd is running > html/index.html
- copy from lighttpd.conf
- copy from mimetype.conf
nano conf.d/mimetype.conf
- check the conf file is ok
lighttpd -tt -f $HOME/lighttpd/lighttpd.conf
- copy from lighttpd.service
- start lighttpd service
mkdir -p ~/.config/systemd/user
cp ~/lighttpd/lighttpd.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now lighttpd
lighttpd.conf#
var.basedir = env.HOME + "/lighttpd"
server.document-root = var.basedir + "/html"
index-file.names = ( "index.html" )
server.username = "nobody"
server.groupname = "nogroup"
server.bind = "127.0.0.1"
server.port = 1080
server.modules += ( "mod_auth", "mod_authn_file", "mod_proxy" )
include var.basedir + "/conf.d/*.conf"
mimetype.conf#
mimetype.use-xattr = "disable"
mimetype.assign = (
".pdf" => "application/pdf",
".sig" => "application/pgp-signature",
".torrent" => "application/x-bittorrent",
".gz" => "application/x-gzip",
".tar.gz" => "application/x-tgz",
".tgz" => "application/x-tgz",
".tar" => "application/x-tar",
".zip" => "application/zip",
".mp3" => "audio/mpeg",
".ogg" => "application/ogg",
".wav" => "audio/x-wav",
".gif" => "image/gif",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".css" => "text/css; charset=utf-8",
".html" => "text/html",
".htm" => "text/html",
".js" => "text/javascript",
".asc" => "text/plain; charset=utf-8",
".c" => "text/plain; charset=utf-8",
".cpp" => "text/plain; charset=utf-8",
".log" => "text/plain; charset=utf-8",
".conf" => "text/plain; charset=utf-8",
".text" => "text/plain; charset=utf-8",
".txt" => "text/plain; charset=utf-8",
".xml" => "text/xml",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv",
".bz2" => "application/x-bzip",
".tbz" => "application/x-bzip-compressed-tar",
".tar.bz2" => "application/x-bzip-compressed-tar",
"" => "application/octet-stream",
)
lighttpd.service#
[Unit]
Description=lighttpd
Wants=network-online.target
After=network-online.target
[Service]
Restart=always
ExecStart=lighttpd -D -f %h/lighttpd/lighttpd.conf
[Install]
WantedBy=default.target