3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #198529 from jqqqqqqqqqq/master

This commit is contained in:
Franz Pletz 2022-11-15 04:58:47 +01:00 committed by GitHub
commit f0609d6c05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -198,8 +198,8 @@ let
${optionalString cfg.statusPage ''
server {
listen 80;
${optionalString enableIPv6 "listen [::]:80;" }
listen ${cfg.defaultHTTPListenPort};
${optionalString enableIPv6 "listen [::]:${cfg.defaultHTTPListenPort};" }
server_name localhost;
@ -246,8 +246,8 @@ let
if vhost.listen != [] then vhost.listen
else
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);
in optionals (hasSSL || vhost.rejectSSL) (map (addr: { inherit addr; port = cfg.defaultSSLListenPort; ssl = true; }) addrs)
++ optionals (!onlySSL) (map (addr: { inherit addr; port = cfg.defaultHTTPListenPort; ssl = false; }) addrs);
hostListen =
if vhost.forceSSL
@ -449,6 +449,24 @@ in
'';
};
defaultHTTPListenPort = mkOption {
type = types.port;
default = 80;
example = 8080;
description = lib.mdDoc ''
If vhosts do not specify listen.port, use these ports for HTTP by default.
'';
};
defaultSSLListenPort = mkOption {
type = types.port;
default = 443;
example = 8443;
description = lib.mdDoc ''
If vhosts do not specify listen.port, use these ports for SSL by default.
'';
};
package = mkOption {
default = pkgs.nginxStable;
defaultText = literalExpression "pkgs.nginxStable";