§2023-04-12

試作機器: h2nas01.yushei.net

  1. install
$ sudo pacman -S lighttpd  
..
Optional dependencies for lighttpd
    libxml2: mod_webdav [installed]
    lua: mod_cml/mod_magnet [installed]
    mariadb-libs: mod_mysql_vhost/mod_authn_mysql [installed]
    sqlite: mod_webdav [installed]
$ pacman -Ql lighttpd
lighttpd /etc/
lighttpd /etc/lighttpd/
lighttpd /etc/lighttpd/lighttpd.conf
lighttpd /etc/logrotate.d/
lighttpd /etc/logrotate.d/lighttpd
lighttpd /usr/
lighttpd /usr/bin/
lighttpd /usr/bin/lighttpd
lighttpd /usr/bin/lighttpd-angel
...
  1. $ cat /etc/lighttpd/lighttpd.conf
# This is a minimal example config
# See /usr/share/doc/lighttpd
# and http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions

server.port             = 80
server.username         = "http"
server.groupname        = "http"
server.document-root    = "/srv/http"
server.errorlog         = "/var/log/lighttpd/error.log"
dir-listing.activate    = "enable"
index-file.names        = ( "index.html" )
mimetype.assign         = (
                                ".html" => "text/html",
                                ".txt" => "text/plain",
                                ".css" => "text/css",
                                ".js" => "application/x-javascript",
                                ".jpg" => "image/jpeg",
                                ".jpeg" => "image/jpeg",
                                ".gif" => "image/gif",
                                ".png" => "image/png",
                                "" => "application/octet-stream"
                        )
  1. enable directory listing and render markdown file

Add the following to end of /etc/lighttpd/lighttpd.conf

server.modules += ("mod_dir", "mod_markdown")
  1. /usr/lib/systemd/system/lighttpd.service
[Unit]
Description=Lighttpd Web Server
After=syslog.target network.target

[Service]
PrivateTmp=true
ExecStart=/usr/bin/lighttpd-angel -D -f /etc/lighttpd/lighttpd.conf
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGINT

[Install]
WantedBy=multi-user.target
systemctl status  lighttpd.service
○ lighttpd.service - Lighttpd Web Server
     Loaded: loaded (/usr/lib/systemd/system/lighttpd.service; disabled; preset: disabled)
     Active: inactive (dead)

Apr 12 12:57:36 h2nas01.yushei.net systemd[1]: Started Lighttpd Web Server.
Apr 12 12:57:36 h2nas01.yushei.net lighttpd-angel[22697]: 2023-04-12 12:57:36: (plugin.c.214) dlopen() failed for: /usr/lib/lighttpd/mod_dir.so /usr/lib/lighttpd/mod_dir.so: cannot open shared object file: No such file or directory
Apr 12 12:57:36 h2nas01.yushei.net lighttpd-angel[22697]: 2023-04-12 12:57:36: (server.c.1448) loading plugins finally failed
Apr 12 12:57:36 h2nas01.yushei.net lighttpd-angel[22696]: lighttpd-angel.c.98: child (pid=22697) exited normally with exitcode: 255
Apr 12 12:57:36 h2nas01.yushei.net systemd[1]: lighttpd.service: Deactivated successfully.