mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
nixos/nginx: Support additional listen parameters (#56835)
This commit is contained in:
parent
6fb8b38afc
commit
3de5726e9b
2 changed files with 3 additions and 1 deletions
|
@ -194,11 +194,12 @@ let
|
||||||
then filter (x: x.ssl) defaultListen
|
then filter (x: x.ssl) defaultListen
|
||||||
else defaultListen;
|
else defaultListen;
|
||||||
|
|
||||||
listenString = { addr, port, ssl, ... }:
|
listenString = { addr, port, ssl, extraParameters ? [], ... }:
|
||||||
"listen ${addr}:${toString port} "
|
"listen ${addr}:${toString port} "
|
||||||
+ optionalString ssl "ssl "
|
+ optionalString ssl "ssl "
|
||||||
+ optionalString (ssl && vhost.http2) "http2 "
|
+ optionalString (ssl && vhost.http2) "http2 "
|
||||||
+ optionalString vhost.default "default_server "
|
+ optionalString vhost.default "default_server "
|
||||||
|
+ optionalString (extraParameters != []) (concatStringsSep " " extraParameters)
|
||||||
+ ";";
|
+ ";";
|
||||||
|
|
||||||
redirectListen = filter (x: !x.ssl) defaultListen;
|
redirectListen = filter (x: !x.ssl) defaultListen;
|
||||||
|
|
|
@ -31,6 +31,7 @@ with lib;
|
||||||
addr = mkOption { type = str; description = "IP address."; };
|
addr = mkOption { type = str; description = "IP address."; };
|
||||||
port = mkOption { type = int; description = "Port number."; default = 80; };
|
port = mkOption { type = int; description = "Port number."; default = 80; };
|
||||||
ssl = mkOption { type = bool; description = "Enable SSL."; default = false; };
|
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 = [];
|
default = [];
|
||||||
example = [
|
example = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue