nixos/nginx: move status page config to `services.nginx`

h7x4 d803f78e 07c3d83a

Changed files
+15 -17
nixos
modules
services
web-servers
nginx
+15 -17
nixos/modules/services/web-servers/nginx/default.nix
···
${proxyCachePathConfig}
-
${optionalString cfg.statusPage ''
-
server {
-
listen ${toString cfg.defaultHTTPListenPort};
-
${optionalString enableIPv6 "listen [::]:${toString cfg.defaultHTTPListenPort};" }
-
-
server_name localhost;
-
-
location /nginx_status {
-
stub_status on;
-
access_log off;
-
allow 127.0.0.1;
-
${optionalString enableIPv6 "allow ::1;"}
-
deny all;
-
}
-
}
-
''}
-
${vhosts}
${cfg.appendHttpConfig}
···
services.nginx.additionalModules = optional cfg.recommendedBrotliSettings pkgs.nginxModules.brotli
++ lib.optional cfg.recommendedZstdSettings pkgs.nginxModules.zstd;
+
+
services.nginx.virtualHosts.localhost = mkIf cfg.statusPage {
+
listenAddresses = lib.mkDefault ([
+
"0.0.0.0"
+
] ++ lib.optional enableIPv6 "[::]");
+
locations."/nginx_status" = {
+
extraConfig = ''
+
stub_status on;
+
access_log off;
+
allow 127.0.0.1;
+
${optionalString enableIPv6 "allow ::1;"}
+
deny all;
+
'';
+
};
+
};
systemd.services.nginx = {
description = "Nginx Web Server";