-# https://mozilla.github.io/server-side-tls/ssl-config-generator/
-
-$SERVER["socket"] == ":443" {
- protocol = "https://"
- ssl.engine = "enable"
- ssl.disable-client-renegotiation = "enable"
-
- # ssl.pemfile: path to the PEM file for SSL support
- # (Should contain both the private key and the certificate)
- ## If you have a .crt and a .key file, cat them together into a single PEM file:
- ## $ cat lighttpd.key lighttpd.crt > lighttpd.pem
- ssl.pemfile = "/etc/lighttpd/ssl/server.pem"
- # ssl.ca-file: path to the CA file for support of chained certificates
+#
+# generated 2023-05-28, Mozilla Guideline v5.7, lighttpd 1.4.70, OpenSSL 3.1.0, intermediate configuration
+# https://ssl-config.mozilla.org/#server=lighttpd&version=1.4.70&config=intermediate&openssl=3.1.0&guideline=5.7
+
+$HTTP["scheme"] == "http" {
+ url.redirect = ("" => "https://${url.authority}${url.path}${qsa}")
+}
+
+# lighttpd 1.4.56 and later will inherit ssl.* from the global scope if
+# $SERVER["socket"] contains ssl.engine = "enable" and no other ssl.* options
+# (to avoid having to repeat ssl.* directives in both ":443" and "[::]:443")
+$SERVER["socket"] == ":443" { ssl.engine = "enable" }
+$SERVER["socket"] == "[::]:443" { ssl.engine = "enable" }
+
+$HTTP["scheme"] == "https" {
+ # HTTP Strict Transport Security (63072000 seconds is around 2 years)
+ setenv.add-response-header = (
+ "Strict-Transport-Security" => "max-age=63072000"
+ )
+}
+
+# ssl.pemfile: path to the PEM file for SSL support
+# (Should contain both the private key and the certificate)
+## If you have a .crt and a .key file, cat them together into a single PEM file:
+## $ cat lighttpd.key lighttpd.crt > lighttpd.pem
+ssl.pemfile = "/etc/lighttpd/ssl/server.pem"
+# ssl.privkey = "/path/to/private_key"
+# ssl.ca-file: path to the CA file for support of chained certificates