Merge pull request #156408 from dali99/nixos-nginx-defaultAddresses
This commit is contained in:
commit
6e71fca817
|
@ -245,12 +245,9 @@ let
|
|||
defaultListen =
|
||||
if vhost.listen != [] then vhost.listen
|
||||
else
|
||||
let addrs = if vhost.listenAddresses != [] then vhost.listenAddresses else (
|
||||
[ "0.0.0.0" ] ++ optional enableIPv6 "[::0]"
|
||||
);
|
||||
in
|
||||
optionals (hasSSL || vhost.rejectSSL) (map (addr: { inherit addr; port = 443; ssl = true; }) addrs)
|
||||
++ optionals (!onlySSL) (map (addr: { inherit addr; port = 80; ssl = false; }) addrs);
|
||||
let addrs = if vhost.listenAddresses != [] then vhost.listenAddresses else cfg.defaultListenAddresses;
|
||||
in optionals (hasSSL || vhost.rejectSSL) (map (addr: { inherit addr; port = 443; ssl = true; }) addrs)
|
||||
++ optionals (!onlySSL) (map (addr: { inherit addr; port = 80; ssl = false; }) addrs);
|
||||
|
||||
hostListen =
|
||||
if vhost.forceSSL
|
||||
|
@ -432,6 +429,16 @@ in
|
|||
";
|
||||
};
|
||||
|
||||
defaultListenAddresses = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "0.0.0.0" ] ++ optional enableIPv6 "[::0]";
|
||||
defaultText = literalExpression ''[ "0.0.0.0" ] ++ lib.optional config.networking.enableIPv6 "[::0]"'';
|
||||
example = literalExpression ''[ "10.0.0.12" "[2002:a00:1::]" ]'';
|
||||
description = "
|
||||
If vhosts do not specify listenAddresses, use these addresses by default.
|
||||
";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
default = pkgs.nginxStable;
|
||||
defaultText = literalExpression "pkgs.nginxStable";
|
||||
|
|
Loading…
Reference in a new issue