summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Andersen <aaron@fosslib.net>2020-04-11 20:03:33 -0400
committerAaron Andersen <aaron@fosslib.net>2020-04-21 20:33:18 -0400
commitee030b121b3e963c753968f34678a89c4f2f006c (patch)
treeb8ff88e62f2a8e787af5f6592ea9aa160a77bd30
parent20f37a443089628fb7fd9d5f941bdabbdd4fecc2 (diff)
nixos/httpd: set modern default values for mpm and http2
-rw-r--r--nixos/modules/services/web-servers/apache-httpd/default.nix24
-rw-r--r--nixos/modules/services/web-servers/apache-httpd/vhost-options.nix2
2 files changed, 13 insertions, 13 deletions
diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix
index 1094ed93e68c..0ab7942e46b5 100644
--- a/nixos/modules/services/web-servers/apache-httpd/default.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/default.nix
@@ -41,9 +41,9 @@ let
"mime" "autoindex" "negotiation" "dir"
"alias" "rewrite"
"unixd" "slotmem_shm" "socache_shmcb"
- "mpm_${cfg.multiProcessingModule}"
+ "mpm_${cfg.mpm}"
]
- ++ (if cfg.multiProcessingModule == "prefork" then [ "cgi" ] else [ "cgid" ])
+ ++ (if cfg.mpm == "prefork" then [ "cgi" ] else [ "cgid" ])
++ optional enableHttp2 "http2"
++ optional enableSSL "ssl"
++ optional enableUserDir "userdir"
@@ -264,7 +264,7 @@ let
PidFile ${runtimeDir}/httpd.pid
- ${optionalString (cfg.multiProcessingModule != "prefork") ''
+ ${optionalString (cfg.mpm != "prefork") ''
# mod_cgid requires this.
ScriptSock ${runtimeDir}/cgisock
''}
@@ -349,6 +349,7 @@ in
imports = [
(mkRemovedOptionModule [ "services" "httpd" "extraSubservices" ] "Most existing subservices have been ported to the NixOS module system. Please update your configuration accordingly.")
(mkRemovedOptionModule [ "services" "httpd" "stateDir" ] "The httpd module now uses /run/httpd as a runtime directory.")
+ (mkRenamedOptionModule [ "services" "httpd" "multiProcessingModule" ] [ "services" "httpd" "mpm" ])
# virtualHosts options
(mkRemovedOptionModule [ "services" "httpd" "documentRoot" ] "Please define a virtual host using `services.httpd.virtualHosts`.")
@@ -544,20 +545,19 @@ in
'';
};
- multiProcessingModule = mkOption {
+ mpm = mkOption {
type = types.enum [ "event" "prefork" "worker" ];
- default = "prefork";
+ default = "event";
example = "worker";
description =
''
Multi-processing module to be used by Apache. Available
- modules are <literal>prefork</literal> (the default;
- handles each request in a separate child process),
- <literal>worker</literal> (hybrid approach that starts a
- number of child processes each running a number of
- threads) and <literal>event</literal> (a recent variant of
- <literal>worker</literal> that handles persistent
- connections more efficiently).
+ modules are <literal>prefork</literal> (handles each
+ request in a separate child process), <literal>worker</literal>
+ (hybrid approach that starts a number of child processes
+ each running a number of threads) and <literal>event</literal>
+ (the default; a recent variant of <literal>worker</literal>
+ that handles persistent connections more efficiently).
'';
};
diff --git a/nixos/modules/services/web-servers/apache-httpd/vhost-options.nix b/nixos/modules/services/web-servers/apache-httpd/vhost-options.nix
index 2e806afb42c5..173c0f8561c0 100644
--- a/nixos/modules/services/web-servers/apache-httpd/vhost-options.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/vhost-options.nix
@@ -137,7 +137,7 @@ in
http2 = mkOption {
type = types.bool;
- default = false;
+ default = true;
description = ''
Whether to enable HTTP 2. HTTP/2 is supported in all multi-processing modules that come with httpd. <emphasis>However, if you use the prefork mpm, there will
be severe restrictions.</emphasis> Refer to <link xlink:href="https://httpd.apache.org/docs/2.4/howto/http2.html#mpm-config"/> for details.