nixos/nginx: add default listen port options
This commit is contained in:
parent
83733b5537
commit
81cd6b06f9
1 changed files with 22 additions and 4 deletions
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue