nginx module: add option to make vhost default

+12 -3
+4 -3
nixos/modules/services/web-servers/nginx/default.nix
··· 77 let 78 ssl = vhost.enableSSL || vhost.forceSSL; 79 port = if vhost.port != null then vhost.port else (if ssl then 443 else 80); 80 - listenString = toString port + optionalString ssl " ssl spdy"; 81 acmeLocation = optionalString vhost.enableACME '' 82 location /.well-known/acme-challenge { 83 try_files $uri @acme-fallback; ··· 92 in '' 93 ${optionalString vhost.forceSSL '' 94 server { 95 - listen 80; 96 - listen [::]:80; 97 98 server_name ${serverName} ${concatStringsSep " " vhost.serverAliases}; 99 ${acmeLocation}
··· 77 let 78 ssl = vhost.enableSSL || vhost.forceSSL; 79 port = if vhost.port != null then vhost.port else (if ssl then 443 else 80); 80 + listenString = toString port + optionalString ssl " ssl spdy" 81 + + optionalString vhost.default " default"; 82 acmeLocation = optionalString vhost.enableACME '' 83 location /.well-known/acme-challenge { 84 try_files $uri @acme-fallback; ··· 93 in '' 94 ${optionalString vhost.forceSSL '' 95 server { 96 + listen 80 ${optionalString vhost.default "default"}; 97 + listen [::]:80 ${optionalString vhost.default "default"}; 98 99 server_name ${serverName} ${concatStringsSep " " vhost.serverAliases}; 100 ${acmeLocation}
+8
nixos/modules/services/web-servers/nginx/vhost-options.nix
··· 80 ''; 81 }; 82 83 extraConfig = mkOption { 84 type = types.lines; 85 default = "";
··· 80 ''; 81 }; 82 83 + default = mkOption { 84 + type = types.bool; 85 + default = false; 86 + description = '' 87 + Makes this vhost the default. 88 + ''; 89 + }; 90 + 91 extraConfig = mkOption { 92 type = types.lines; 93 default = "";