Skip to content

Commit

Permalink
nixos/nginx: Support additional listen parameters (#56971)
Browse files Browse the repository at this point in the history
(cherry picked from commit 57e8b48)
  • Loading branch information
dasJ authored and danbst committed Mar 6, 2019
1 parent 17a5b64 commit c6f607a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nixos/modules/services/web-servers/nginx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,12 @@ let
then filter (x: x.ssl) defaultListen
else defaultListen;

listenString = { addr, port, ssl, ... }:
listenString = { addr, port, ssl, extraParameters ? [], ... }:
"listen ${addr}:${toString port} "
+ optionalString ssl "ssl "
+ optionalString (ssl && vhost.http2) "http2 "
+ optionalString vhost.default "default_server "
+ optionalString (extraParameters != []) (concatStringsSep " " extraParameters)
+ ";";

redirectListen = filter (x: !x.ssl) defaultListen;
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/services/web-servers/nginx/vhost-options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ with lib;
addr = mkOption { type = str; description = "IP address."; };
port = mkOption { type = int; description = "Port number."; default = 80; };
ssl = mkOption { type = bool; description = "Enable SSL."; default = false; };
extraParameters = mkOption { type = listOf str; description = "Extra parameters of this listen directive."; default = []; example = [ "reuseport" "deferred" ]; };
}; });
default = [];
example = [
Expand Down

0 comments on commit c6f607a

Please sign in to comment.