nginx: Add alias configuration option for hosts and locations.
It's like root, but doesn't keep the prefix.
This commit is contained in:
parent
53a2baabbe
commit
ff2e2e82cc
@ -158,6 +158,7 @@ let
|
|||||||
server_name ${serverName} ${concatStringsSep " " vhost.serverAliases};
|
server_name ${serverName} ${concatStringsSep " " vhost.serverAliases};
|
||||||
${acmeLocation}
|
${acmeLocation}
|
||||||
${optionalString (vhost.root != null) "root ${vhost.root};"}
|
${optionalString (vhost.root != null) "root ${vhost.root};"}
|
||||||
|
${optionalString (vhost.alias != null) "alias ${vhost.alias};"}
|
||||||
${optionalString (vhost.globalRedirect != null) ''
|
${optionalString (vhost.globalRedirect != null) ''
|
||||||
return 301 http${optionalString ssl "s"}://${vhost.globalRedirect}$request_uri;
|
return 301 http${optionalString ssl "s"}://${vhost.globalRedirect}$request_uri;
|
||||||
''}
|
''}
|
||||||
@ -180,6 +181,7 @@ let
|
|||||||
${optionalString (config.index != null) "index ${config.index};"}
|
${optionalString (config.index != null) "index ${config.index};"}
|
||||||
${optionalString (config.tryFiles != null) "try_files ${config.tryFiles};"}
|
${optionalString (config.tryFiles != null) "try_files ${config.tryFiles};"}
|
||||||
${optionalString (config.root != null) "root ${config.root};"}
|
${optionalString (config.root != null) "root ${config.root};"}
|
||||||
|
${optionalString (config.alias != null) "alias ${config.alias};"}
|
||||||
${config.extraConfig}
|
${config.extraConfig}
|
||||||
}
|
}
|
||||||
'') locations);
|
'') locations);
|
||||||
|
@ -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 {
|
extraConfig = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
|
@ -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 {
|
default = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user