Merge pull request #131962 from mkg20001/fc-nginx

This commit is contained in:
Maciej Krüger 2021-08-12 14:07:48 +02:00 committed by GitHub
commit 5d73f669a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 7 deletions

View File

@ -232,13 +232,13 @@ let
defaultListen =
if vhost.listen != [] then vhost.listen
else optionals (hasSSL || vhost.rejectSSL) (
singleton { addr = "0.0.0.0"; port = 443; ssl = true; }
++ optional enableIPv6 { addr = "[::]"; port = 443; ssl = true; }
) ++ optionals (!onlySSL) (
singleton { addr = "0.0.0.0"; port = 80; ssl = false; }
++ optional enableIPv6 { addr = "[::]"; port = 80; ssl = false; }
);
else
let addrs = if vhost.listenAddresses != [] then vhost.listenAddreses 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);
hostListen =
if vhost.forceSSL

View File

@ -43,9 +43,26 @@ with lib;
IPv6 addresses must be enclosed in square brackets.
Note: this option overrides <literal>addSSL</literal>
and <literal>onlySSL</literal>.
If you only want to set the addresses manually and not
the ports, take a look at <literal>listenAddresses</literal>
'';
};
listenAddresses = mkOption {
type = with types; listOf str;
description = ''
Listen addresses for this virtual host.
Compared to <literal>listen</literal> this only sets the addreses
and the ports are choosen automatically.
Note: This option overrides <literal>enableIPv6</literal>
'';
default = [];
example = [ "127.0.0.1" "::1" ];
};
enableACME = mkOption {
type = types.bool;
default = false;