tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
nginx module: add option to make vhost default
Robin Gloster
9 years ago
3830a890
13894550
+12
-3
2 changed files
expand all
collapse all
unified
split
nixos
modules
services
web-servers
nginx
default.nix
vhost-options.nix
+4
-3
nixos/modules/services/web-servers/nginx/default.nix
···
77
77
let
78
78
ssl = vhost.enableSSL || vhost.forceSSL;
79
79
port = if vhost.port != null then vhost.port else (if ssl then 443 else 80);
80
80
-
listenString = toString port + optionalString ssl " ssl spdy";
80
80
+
listenString = toString port + optionalString ssl " ssl spdy"
81
81
+
+ optionalString vhost.default " default";
81
82
acmeLocation = optionalString vhost.enableACME ''
82
83
location /.well-known/acme-challenge {
83
84
try_files $uri @acme-fallback;
···
92
93
in ''
93
94
${optionalString vhost.forceSSL ''
94
95
server {
95
95
-
listen 80;
96
96
-
listen [::]:80;
96
96
+
listen 80 ${optionalString vhost.default "default"};
97
97
+
listen [::]:80 ${optionalString vhost.default "default"};
97
98
98
99
server_name ${serverName} ${concatStringsSep " " vhost.serverAliases};
99
100
${acmeLocation}
+8
nixos/modules/services/web-servers/nginx/vhost-options.nix
···
80
80
'';
81
81
};
82
82
83
83
+
default = mkOption {
84
84
+
type = types.bool;
85
85
+
default = false;
86
86
+
description = ''
87
87
+
Makes this vhost the default.
88
88
+
'';
89
89
+
};
90
90
+
83
91
extraConfig = mkOption {
84
92
type = types.lines;
85
93
default = "";