Merge pull request #189 from bjornfor/lighttpd-fix-module-handling
lighttpd: improve module handling
This commit is contained in:
commit
8622bd81c8
@ -45,12 +45,6 @@ in
|
|||||||
environment.systemPackages = [ pkgs.cgit ];
|
environment.systemPackages = [ pkgs.cgit ];
|
||||||
|
|
||||||
services.lighttpd.extraConfig = ''
|
services.lighttpd.extraConfig = ''
|
||||||
server.modules += (
|
|
||||||
"mod_cgi",
|
|
||||||
"mod_alias",
|
|
||||||
"mod_setenv"
|
|
||||||
)
|
|
||||||
|
|
||||||
$HTTP["url"] =~ "^/cgit" {
|
$HTTP["url"] =~ "^/cgit" {
|
||||||
cgi.assign = (
|
cgi.assign = (
|
||||||
"cgit.cgi" => "${pkgs.cgit}/cgit/cgit.cgi"
|
"cgit.cgi" => "${pkgs.cgit}/cgit/cgit.cgi"
|
||||||
|
@ -8,6 +8,13 @@ let
|
|||||||
|
|
||||||
cfg = config.services.lighttpd;
|
cfg = config.services.lighttpd;
|
||||||
|
|
||||||
|
needModRedirect = cfg.gitweb.enable;
|
||||||
|
needModAlias = cfg.cgit.enable or cfg.gitweb.enable;
|
||||||
|
needModSetenv = cfg.cgit.enable or cfg.gitweb.enable;
|
||||||
|
needModCgi = cfg.cgit.enable or cfg.gitweb.enable;
|
||||||
|
needModStatus = cfg.mod_status;
|
||||||
|
needModUserdir = cfg.mod_userdir;
|
||||||
|
|
||||||
configFile = if cfg.configText != "" then
|
configFile = if cfg.configText != "" then
|
||||||
pkgs.writeText "lighttpd.conf" ''
|
pkgs.writeText "lighttpd.conf" ''
|
||||||
${cfg.configText}
|
${cfg.configText}
|
||||||
@ -19,8 +26,28 @@ let
|
|||||||
server.username = "lighttpd"
|
server.username = "lighttpd"
|
||||||
server.groupname = "lighttpd"
|
server.groupname = "lighttpd"
|
||||||
|
|
||||||
|
# As for why all modules are loaded here, instead of having small
|
||||||
|
# server.modules += () entries in each sub-service extraConfig snippet,
|
||||||
|
# read this:
|
||||||
|
#
|
||||||
|
# http://redmine.lighttpd.net/projects/1/wiki/Server_modulesDetails
|
||||||
|
# http://redmine.lighttpd.net/issues/2337
|
||||||
|
#
|
||||||
|
# Basically, lighttpd doesn't want to load (or even silently ignore) a
|
||||||
|
# module for a second time, and there is no way to check if a module has
|
||||||
|
# been loaded already. So if two services were to put the same module in
|
||||||
|
# server.modules += (), that would break the lighttpd configuration.
|
||||||
|
server.modules = (
|
||||||
|
${optionalString needModRedirect ''"mod_redirect",''}
|
||||||
|
${optionalString needModAlias ''"mod_alias",''}
|
||||||
|
${optionalString needModSetenv ''"mod_setenv",''}
|
||||||
|
${optionalString needModCgi ''"mod_cgi",''}
|
||||||
|
${optionalString needModStatus ''"mod_status",''}
|
||||||
|
${optionalString needModUserdir ''"mod_userdir",''}
|
||||||
|
"mod_accesslog"
|
||||||
|
)
|
||||||
|
|
||||||
# Logging (logs end up in systemd journal)
|
# Logging (logs end up in systemd journal)
|
||||||
server.modules += ("mod_accesslog")
|
|
||||||
accesslog.use-syslog = "enable"
|
accesslog.use-syslog = "enable"
|
||||||
server.errorlog-use-syslog = "enable"
|
server.errorlog-use-syslog = "enable"
|
||||||
|
|
||||||
@ -37,12 +64,10 @@ let
|
|||||||
index-file.names = ( "index.html" )
|
index-file.names = ( "index.html" )
|
||||||
|
|
||||||
${if cfg.mod_userdir then ''
|
${if cfg.mod_userdir then ''
|
||||||
server.modules += ("mod_userdir")
|
|
||||||
userdir.path = "public_html"
|
userdir.path = "public_html"
|
||||||
'' else ""}
|
'' else ""}
|
||||||
|
|
||||||
${if cfg.mod_status then ''
|
${if cfg.mod_status then ''
|
||||||
server.modules += ("mod_status")
|
|
||||||
status.status-url = "/server-status"
|
status.status-url = "/server-status"
|
||||||
status.statistics-url = "/server-statistics"
|
status.statistics-url = "/server-statistics"
|
||||||
status.config-url = "/server-config"
|
status.config-url = "/server-config"
|
||||||
|
@ -45,12 +45,6 @@ in
|
|||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
services.lighttpd.extraConfig = ''
|
services.lighttpd.extraConfig = ''
|
||||||
server.modules += (
|
|
||||||
"mod_alias",
|
|
||||||
"mod_cgi",
|
|
||||||
"mod_redirect",
|
|
||||||
"mod_setenv"
|
|
||||||
)
|
|
||||||
$HTTP["url"] =~ "^/gitweb" {
|
$HTTP["url"] =~ "^/gitweb" {
|
||||||
cgi.assign = (
|
cgi.assign = (
|
||||||
".cgi" => "${pkgs.perl}/bin/perl"
|
".cgi" => "${pkgs.perl}/bin/perl"
|
||||||
|
Loading…
Reference in New Issue
Block a user