mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-19 04:02:10 +00:00
nginx module: add option to make vhost default
This commit is contained in:
parent
138945500e
commit
3830a890ab
|
@ -77,7 +77,8 @@ let
|
|||
let
|
||||
ssl = vhost.enableSSL || vhost.forceSSL;
|
||||
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 ''
|
||||
location /.well-known/acme-challenge {
|
||||
try_files $uri @acme-fallback;
|
||||
|
@ -92,8 +93,8 @@ let
|
|||
in ''
|
||||
${optionalString vhost.forceSSL ''
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
listen 80 ${optionalString vhost.default "default"};
|
||||
listen [::]:80 ${optionalString vhost.default "default"};
|
||||
|
||||
server_name ${serverName} ${concatStringsSep " " vhost.serverAliases};
|
||||
${acmeLocation}
|
||||
|
|
|
@ -80,6 +80,14 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
default = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Makes this vhost the default.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
|
|
Loading…
Reference in a new issue