git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #60021 from aanderse/httpd-cleanup

nixos/httpd: cleanup old apache2.2 syntax

commitfae95c2c82a492ca4a253d033c0855ea42156608 authorAaron Andersen <aaron@fosslib.net> dateThu 6 Jun 2019, 06:46 (7 years ago) parent4bb48e7e5b583b
1 file changed+13−42
nixos/modules/services/web-servers/apache-httpd/default.nix+13−42
nixos/modules/services/web-servers/apache-httpd/default.nix+13−42
@@ -8,8 +8,6 @@ let
88
99 httpd = mainCfg.package.out;
1010
11− version24 = !versionOlder httpd.version "2.4";
12−
1311 httpdConf = mainCfg.configFile;
1412
1513 php = mainCfg.phpPackage.override { apacheHttpd = httpd.dev; /* otherwise it only gets .out */ };
@@ -107,11 +105,10 @@ let
107105 "auth_basic" "auth_digest"
108106
109107 # Authentication: is the user who he claims to be?
110− "authn_file" "authn_dbm" "authn_anon"
111− (if version24 then "authn_core" else "authn_alias")
108+ "authn_file" "authn_dbm" "authn_anon" "authn_core"
112109
113110 # Authorization: is the user allowed access?
114− "authz_user" "authz_groupfile" "authz_host"
111+ "authz_user" "authz_groupfile" "authz_host" "authz_core"
115112
116113 # Other modules.
117114 "ext_filter" "include" "log_config" "env" "mime_magic"
@@ -119,14 +116,9 @@ let
119116 "mime" "dav" "status" "autoindex" "asis" "info" "dav_fs"
120117 "vhost_alias" "negotiation" "dir" "imagemap" "actions" "speling"
121118 "userdir" "alias" "rewrite" "proxy" "proxy_http"
122− ]
123− ++ optionals version24 [
119+ "unixd" "cache" "cache_disk" "slotmem_shm" "socache_shmcb"
124120 "mpm_${mainCfg.multiProcessingModule}"
125− "authz_core"
126− "unixd"
127− "cache" "cache_disk"
128− "slotmem_shm"
129− "socache_shmcb"
121+
130122 # For compatibility with old configurations, the new module mod_access_compat is provided.
131123 "access_compat"
132124 ]
@@ -135,19 +127,8 @@ let
135127 ++ extraApacheModules;
136128
137129
138− allDenied = if version24 then ''
139− Require all denied
140− '' else ''
141− Order deny,allow
142− Deny from all
143− '';
144−
145− allGranted = if version24 then ''
146− Require all granted
147− '' else ''
148− Order allow,deny
149− Allow from all
150− '';
130+ allDenied = "Require all denied";
131+ allGranted = "Require all granted";
151132
152133
153134 loggingConf = (if mainCfg.logFormat != "none" then ''
@@ -180,9 +161,9 @@ let
180161
181162
182163 sslConf = ''
183− SSLSessionCache ${if version24 then "shmcb" else "shm"}:${mainCfg.stateDir}/ssl_scache(512000)
164+ SSLSessionCache shmcb:${mainCfg.stateDir}/ssl_scache(512000)
184165
185− ${if version24 then "Mutex" else "SSLMutex"} posixsem
166+ Mutex posixsem
186167
187168 SSLRandomSeed startup builtin
188169 SSLRandomSeed connect builtin
@@ -322,9 +303,7 @@ let
322303
323304 ServerRoot ${httpd}
324305
325− ${optionalString version24 ''
326− DefaultRuntimeDir ${mainCfg.stateDir}/runtime
327− ''}
306+ DefaultRuntimeDir ${mainCfg.stateDir}/runtime
328307
329308 PidFile ${mainCfg.stateDir}/httpd.pid
330309
@@ -397,14 +376,6 @@ let
397376 # Generate directives for the main server.
398377 ${perServerConf true mainCfg}
399378
400− # Always enable virtual hosts; it doesn't seem to hurt.
401− ${let
402− listen = concatMap getListen allHosts;
403− uniqueListen = uniqList {inputList = listen;};
404− directives = concatMapStrings (listen: "NameVirtualHost ${listenToString listen}\n") uniqueListen;
405− in optionalString (!version24) directives
406− }
407−
408379 ${let
409380 makeVirtualHost = vhost: ''
410381 <VirtualHost ${concatStringsSep " " (map listenToString (getListen vhost))}>
@@ -717,10 +688,10 @@ in
717688 ''
718689 mkdir -m 0750 -p ${mainCfg.stateDir}
719690 [ $(id -u) != 0 ] || chown root.${mainCfg.group} ${mainCfg.stateDir}
720− ${optionalString version24 ''
721− mkdir -m 0750 -p "${mainCfg.stateDir}/runtime"
722− [ $(id -u) != 0 ] || chown root.${mainCfg.group} "${mainCfg.stateDir}/runtime"
723− ''}
691+
692+ mkdir -m 0750 -p "${mainCfg.stateDir}/runtime"
693+ [ $(id -u) != 0 ] || chown root.${mainCfg.group} "${mainCfg.stateDir}/runtime"
694+
724695 mkdir -m 0700 -p ${mainCfg.logDir}
725696
726697 # Get rid of old semaphores. These tend to accumulate across