lighttpd: lighttpd.conf vars, comments, guidance
authorGlenn Strauss <gstrauss@gluelogic.com>
Wed, 30 Nov 2022 03:22:14 +0000 (22:22 -0500)
committerRosen Penev <rosenp@gmail.com>
Fri, 2 Dec 2022 03:02:21 +0000 (19:02 -0800)
lighttpd.conf variables, documentation comments, configuration guidance

Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
net/lighttpd/files/lighttpd.conf
net/lighttpd/files/lighttpd.init

index 64640779faa1e1f0bc87ea654ac739fde46474d2..4ce516d908af816377b7bac2bf3f04e548a6d7ec 100644 (file)
@@ -1,34 +1,41 @@
-server.document-root        = "/www"
+### Documentation
+# https://wiki.lighttpd.net/
+#
+### Configuration Syntax
+# https://wiki.lighttpd.net/Docs_Configuration
+#
+### Configuration Options
+# https://wiki.lighttpd.net/Docs_ConfigurationOptions
+#
+### Configuration Variables (potentially used in /etc/lighttpd/conf.d/*.conf)
+var.log_root    = "/var/log/lighttpd/"
+var.server_root = "/www/"
+var.state_dir   = "/var/run/"
+var.home_dir    = "/var/lib/lighttpd/"
+var.conf_dir    = "/etc/lighttpd"
+var.vhosts_dir  = server_root + "/vhosts"
+var.cache_dir   = "/var/cache/lighttpd"
+var.socket_dir  = home_dir + "/sockets"
+
+### OpenWRT lighttpd base configuration
+server.document-root        = server_root
 server.upload-dirs          = ( "/tmp" )
-server.errorlog             = "/var/log/lighttpd/error.log"
-server.pid-file             = "/var/run/lighttpd.pid"
+server.errorlog             = log_root + "error.log"
+server.pid-file             = state_dir + "lighttpd.pid"
 server.username             = "http"
 server.groupname            = "www-data"
 
+# historical; preserved for compatibility; should have been disabled by default
 index-file.names            = ( "index.php", "index.html",
                                 "index.htm", "default.htm",
                               )
 
 static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
 
-### Features
-#https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_feature-flagsDetails
-server.feature-flags       += ("server.graceful-shutdown-timeout" => 5)
-#server.feature-flags       += ("server.graceful-restart-bg" => "enable")
-
-### Options that are useful but not always necessary:
-#server.chroot               = "/"
-#server.port                 = 81
-#server.bind                 = "localhost"
-#server.tag                  = "lighttpd"
-#server.errorlog-use-syslog  = "enable"
-#server.network-backend      = "writev"
-
-### Use IPv6 if available
-#include_shell "/usr/share/lighttpd/use-ipv6.pl"
-
-#dir-listing.encoding        = "utf-8"
-#dir-listing.activate        = "enable"
-
 include "/etc/lighttpd/mime.conf"
 include "/etc/lighttpd/conf.d/*.conf"
+
+### Customizations
+# customizations should generally be placed in separate files such as
+#   /etc/lighttpd/conf.d/00_vars.conf    # override variables for conf.d/*.conf
+#   /etc/lighttpd/conf.d/zz_custom.conf  # override other conf.d/*.conf settings
index 04de1784516162f62ed1c32a2e34f1544d30e08e..ffaae34a21e0aecc2d73c2c952fee0cb585efca8 100644 (file)
@@ -16,10 +16,12 @@ validate_conf() {
 
 start_service() {
        user_exists http || user_add http
-       [ -d /var/log/lighttpd ] || {
-               mkdir -m 0775 -p /var/log/lighttpd
-               chgrp www-data /var/log/lighttpd
-       }
+       for i in /var/log/lighttpd /var/lib/lighttpd /var/cache/lighttpd; do
+               [ -d "$i" ] || {
+                       mkdir -m 0775 -p "$i"
+                       chgrp www-data "$i"
+               }
+       done
 
        validate_conf || exit 1