1
0
Fork 1
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:
Robin Gloster 2016-04-03 10:58:34 +00:00
parent 138945500e
commit 3830a890ab
2 changed files with 12 additions and 3 deletions

View file

@ -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}

View file

@ -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 = "";