nginx module: add option to make vhost default
This commit is contained in:
parent
138945500e
commit
3830a890ab
@ -77,7 +77,8 @@ let
|
|||||||
let
|
let
|
||||||
ssl = vhost.enableSSL || vhost.forceSSL;
|
ssl = vhost.enableSSL || vhost.forceSSL;
|
||||||
port = if vhost.port != null then vhost.port else (if ssl then 443 else 80);
|
port = if vhost.port != null then vhost.port else (if ssl then 443 else 80);
|
||||||
listenString = toString port + optionalString ssl " ssl spdy";
|
listenString = toString port + optionalString ssl " ssl spdy"
|
||||||
|
+ optionalString vhost.default " default";
|
||||||
acmeLocation = optionalString vhost.enableACME ''
|
acmeLocation = optionalString vhost.enableACME ''
|
||||||
location /.well-known/acme-challenge {
|
location /.well-known/acme-challenge {
|
||||||
try_files $uri @acme-fallback;
|
try_files $uri @acme-fallback;
|
||||||
@ -92,8 +93,8 @@ let
|
|||||||
in ''
|
in ''
|
||||||
${optionalString vhost.forceSSL ''
|
${optionalString vhost.forceSSL ''
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80 ${optionalString vhost.default "default"};
|
||||||
listen [::]:80;
|
listen [::]:80 ${optionalString vhost.default "default"};
|
||||||
|
|
||||||
server_name ${serverName} ${concatStringsSep " " vhost.serverAliases};
|
server_name ${serverName} ${concatStringsSep " " vhost.serverAliases};
|
||||||
${acmeLocation}
|
${acmeLocation}
|
||||||
|
@ -80,6 +80,14 @@ with lib;
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
default = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Makes this vhost the default.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
|
Loading…
Reference in New Issue
Block a user