summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorEvan Danaher <edanaher@edanaher.net>2017-03-09 13:02:29 -0500
committerEvan Danaher <edanaher@edanaher.net>2017-03-09 13:02:29 -0500
commitff2e2e82ccc2eebc36220613b332efa475dcca51 (patch)
treeba47abc9100e693954b07a5a97a5ba4b46ef3d96 /nixos/modules/services
parent53a2baabbeb29ce0180b0353deb623139f1808bd (diff)
downloadnixlib-ff2e2e82ccc2eebc36220613b332efa475dcca51.tar
nixlib-ff2e2e82ccc2eebc36220613b332efa475dcca51.tar.gz
nixlib-ff2e2e82ccc2eebc36220613b332efa475dcca51.tar.bz2
nixlib-ff2e2e82ccc2eebc36220613b332efa475dcca51.tar.lz
nixlib-ff2e2e82ccc2eebc36220613b332efa475dcca51.tar.xz
nixlib-ff2e2e82ccc2eebc36220613b332efa475dcca51.tar.zst
nixlib-ff2e2e82ccc2eebc36220613b332efa475dcca51.zip
nginx: Add alias configuration option for hosts and locations.
It's like root, but doesn't keep the prefix.
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/web-servers/nginx/default.nix2
-rw-r--r--nixos/modules/services/web-servers/nginx/location-options.nix9
-rw-r--r--nixos/modules/services/web-servers/nginx/vhost-options.nix9
3 files changed, 20 insertions, 0 deletions
diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix
index 9e93e56b9c2c..4ad272deb376 100644
--- a/nixos/modules/services/web-servers/nginx/default.nix
+++ b/nixos/modules/services/web-servers/nginx/default.nix
@@ -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);
diff --git a/nixos/modules/services/web-servers/nginx/location-options.nix b/nixos/modules/services/web-servers/nginx/location-options.nix
index e1885b160664..83ce0f717341 100644
--- a/nixos/modules/services/web-servers/nginx/location-options.nix
+++ b/nixos/modules/services/web-servers/nginx/location-options.nix
@@ -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 = "";
diff --git a/nixos/modules/services/web-servers/nginx/vhost-options.nix b/nixos/modules/services/web-servers/nginx/vhost-options.nix
index c0ea645b3dfe..a76a971aff06 100644
--- a/nixos/modules/services/web-servers/nginx/vhost-options.nix
+++ b/nixos/modules/services/web-servers/nginx/vhost-options.nix
@@ -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;