mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
Merge pull request #23672 from edanaher/nginx-alias
Nginx alias directive
This commit is contained in:
commit
02129a8788
@ -185,6 +185,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);
|
||||
@ -403,6 +404,13 @@ in
|
||||
config = mkIf cfg.enable {
|
||||
# TODO: test user supplied config file pases syntax test
|
||||
|
||||
assertions = let hostOrAliasIsNull = l: l.root == null || l.alias == null; in [
|
||||
{
|
||||
assertion = all (host: all hostOrAliasIsNull (attrValues host.locations)) (attrValues virtualHosts);
|
||||
message = "Only one of nginx root or alias can be specified on a location.";
|
||||
}
|
||||
];
|
||||
|
||||
systemd.services.nginx = {
|
||||
description = "Nginx Web Server";
|
||||
after = [ "network.target" ];
|
||||
|
@ -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 = "";
|
||||
|
Loading…
Reference in New Issue
Block a user