Skip to content

Commit

Permalink
nixos/httpd: add http2 option
Browse files Browse the repository at this point in the history
  • Loading branch information
aanderse committed Feb 2, 2020
1 parent 5da9abd commit 5b5856f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nixos/modules/services/web-servers/apache-httpd/default.nix
Expand Up @@ -29,8 +29,8 @@ let

listenInfo = unique (concatMap mkListenInfo vhosts);

enableHttp2 = any (vhost: vhost.http2) vhosts;
enableSSL = any (listen: listen.ssl) listenInfo;

enableUserDir = any (vhost: vhost.enableUserDir) vhosts;

# NOTE: generally speaking order of modules is very important
Expand All @@ -44,6 +44,7 @@ let
"mpm_${cfg.multiProcessingModule}"
]
++ (if cfg.multiProcessingModule == "prefork" then [ "cgi" ] else [ "cgid" ])
++ optional enableHttp2 "http2"
++ optional enableSSL "ssl"
++ optional enableUserDir "userdir"
++ optional cfg.enableMellon { name = "auth_mellon"; path = "${pkgs.apacheHttpdPackages.mod_auth_mellon}/modules/mod_auth_mellon.so"; }
Expand Down Expand Up @@ -164,6 +165,7 @@ let
SSLCertificateFile ${sslServerCert}
SSLCertificateKeyFile ${sslServerKey}
${optionalString (sslServerChain != null) "SSLCertificateChainFile ${sslServerChain}"}
${optionalString hostOpts.http2 "Protocols h2 h2c http/1.1"}
${acmeChallenge}
${mkVHostCommonConf hostOpts}
</VirtualHost>
Expand Down
Expand Up @@ -135,6 +135,15 @@ in
description = "Path to server SSL chain file.";
};

http2 = mkOption {
type = types.bool;
default = false;
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.
'';
};

adminAddr = mkOption {
type = types.nullOr types.str;
default = null;
Expand Down

0 comments on commit 5b5856f

Please sign in to comment.