nginx: Add alias configuration option for hosts and locations.

It's like root, but doesn't keep the prefix.
This commit is contained in:
Evan Danaher 2017-03-09 13:02:29 -05:00
parent 53a2baabbe
commit ff2e2e82cc
3 changed files with 20 additions and 0 deletions

View File

@ -158,6 +158,7 @@ let
server_name ${serverName} ${concatStringsSep " " vhost.serverAliases};
${acmeLocation}
${optionalString (vhost.root != null) "root ${vhost.root};"}
${optionalString (vhost.alias != null) "alias ${vhost.alias};"}
${optionalString (vhost.globalRedirect != null) ''
return 301 http${optionalString ssl "s"}://${vhost.globalRedirect}$request_uri;
''}
@ -180,6 +181,7 @@ let
${optionalString (config.index != null) "index ${config.index};"}
${optionalString (config.tryFiles != null) "try_files ${config.tryFiles};"}
${optionalString (config.root != null) "root ${config.root};"}
${optionalString (config.alias != null) "alias ${config.alias};"}
${config.extraConfig}
}
'') locations);

View File

@ -45,6 +45,15 @@ with lib;
'';
};
alias = mkOption {
type = types.nullOr types.path;
default = null;
example = "/your/alias/directory";
description = ''
Alias directory for requests.
'';
};
extraConfig = mkOption {
type = types.lines;
default = "";

View File

@ -89,6 +89,15 @@ with lib;
'';
};
alias = mkOption {
type = types.nullOr types.path;
default = null;
example = "/data/webserver/docs";
description = ''
The path of the web alias directory.
'';
};
default = mkOption {
type = types.bool;
default = false;