nixos/nginx: add reuseport option

This commit is contained in:
Izorkin
2022-03-07 15:44:24 +03:00
committed by Yuka
parent 660a36f173
commit c508da303b
2 changed files with 14 additions and 3 deletions

View File

@@ -259,6 +259,7 @@ let
# UDP listener for **QUIC+HTTP/3
listen ${addr}:${toString port} http3 "
+ optionalString vhost.default "default_server "
+ optionalString vhost.reuseport "reuseport "
+ ";" else "")
+ "
@@ -266,6 +267,7 @@ let
+ optionalString (ssl && vhost.http2) "http2 "
+ optionalString ssl "ssl "
+ optionalString vhost.default "default_server "
+ optionalString vhost.reuseport "reuseport "
+ optionalString (extraParameters != []) (concatStringsSep " " extraParameters)
+ ";";

View File

@@ -31,7 +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" ]; };
extraParameters = mkOption { type = listOf str; description = "Extra parameters of this listen directive."; default = []; example = [ "backlog=1024" "deferred" ]; };
}; });
default = [];
example = [
@@ -207,6 +207,15 @@ with lib;
'';
};
reuseport = mkOption {
type = types.bool;
default = false;
description = ''
Create an individual listening socket .
It is required to specify only once on one of the hosts.
'';
};
root = mkOption {
type = types.nullOr types.path;
default = null;