summary refs log tree commit diff
path: root/nixos/modules/services/web-servers
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2016-07-26 14:09:05 +0000
committerRobin Gloster <mail@glob.in>2016-07-28 11:59:13 +0000
commit91680de317b0a134c5a6b6bad441013aa6ed233a (patch)
treece1a1255057891e58b76788fc0666ba020d3f93b /nixos/modules/services/web-servers
parenta294ad01b38d9108e02d18aa9788143c15d1e151 (diff)
downloadnixlib-91680de317b0a134c5a6b6bad441013aa6ed233a.tar
nixlib-91680de317b0a134c5a6b6bad441013aa6ed233a.tar.gz
nixlib-91680de317b0a134c5a6b6bad441013aa6ed233a.tar.bz2
nixlib-91680de317b0a134c5a6b6bad441013aa6ed233a.tar.lz
nixlib-91680de317b0a134c5a6b6bad441013aa6ed233a.tar.xz
nixlib-91680de317b0a134c5a6b6bad441013aa6ed233a.tar.zst
nixlib-91680de317b0a134c5a6b6bad441013aa6ed233a.zip
nginx module: add statusPage option
Diffstat (limited to 'nixos/modules/services/web-servers')
-rw-r--r--nixos/modules/services/web-servers/nginx/default.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix
index c8486d3bfcd0..1e5a8b9bc357 100644
--- a/nixos/modules/services/web-servers/nginx/default.nix
+++ b/nixos/modules/services/web-servers/nginx/default.nix
@@ -69,7 +69,23 @@ let
       client_max_body_size    10m;
 
       server_tokens ${if cfg.serverTokens then "on" else "off"};
+
       ${vhosts}
+
+      ${optionalString cfg.statusPage ''
+        server {
+          listen 80;
+          listen [::]:80;
+
+          server_name localhost;
+
+          location /nginx_status {
+            stub_status on;
+            allow 127.0.0.1;
+            deny all;
+          }
+        }
+      ''}
     }
 
     ${cfg.config}
@@ -163,6 +179,14 @@ in
     services.nginx = {
       enable = mkEnableOption "Nginx Web Server";
 
+      statusPage = mkOption {
+        default = false;
+        type = types.bool;
+        description = "
+          Enable status page reachable from localhost on http://127.0.0.1/nginx_status.
+        ";
+      };
+
       recommendedTlsSettings = mkOption {
         default = false;
         type = types.bool;