3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #57596 from artemist/nginx-return

nixos/nginx: add return option to location
This commit is contained in:
Dmitry Kalinkin 2019-03-22 14:08:33 -04:00 committed by GitHub
commit 0e57b98b2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -276,6 +276,7 @@ let
${optionalString (config.tryFiles != null) "try_files ${config.tryFiles};"}
${optionalString (config.root != null) "root ${config.root};"}
${optionalString (config.alias != null) "alias ${config.alias};"}
${optionalString (config.return != null) "return ${config.return};"}
${config.extraConfig}
${optionalString (config.proxyPass != null && cfg.recommendedProxySettings) "include ${recommendedProxyConfig};"}
}
@ -373,7 +374,7 @@ in
preStart = mkOption {
type = types.lines;
default = ''
test -d ${cfg.stateDir}/logs || mkdir -m 750 -p ${cfg.stateDir}/logs
test -d ${cfg.stateDir}/logs || mkdir -m 750 -p ${cfg.stateDir}/logs
test `stat -c %a ${cfg.stateDir}` = "750" || chmod 750 ${cfg.stateDir}
test `stat -c %a ${cfg.stateDir}/logs` = "750" || chmod 750 ${cfg.stateDir}/logs
chown -R ${cfg.user}:${cfg.group} ${cfg.stateDir}

View file

@ -64,6 +64,15 @@ with lib;
'';
};
return = mkOption {
type = types.nullOr types.str;
default = null;
example = "301 http://example.com$request_uri;";
description = ''
Adds a return directive, for e.g. redirections.
'';
};
extraConfig = mkOption {
type = types.lines;
default = "";