nixos/modules/services/nginx.nix

42 lines
825 B
Nix

{
lib,
config,
info,
...
}:
let
cfg = info.monitoring;
in
{
services.nginx = lib.mkIf config.services.nginx.enable {
recommendedProxySettings = true;
recommendedOptimisation = true;
clientMaxBodySize = "512M";
# On trust nos ip internes pour bien indiquer le client au bout
# i.e. on considère pas le reverseproxy comme notre client
appendHttpConfig = ''
set_real_ip_from 172.16.0.0/16;
set_real_ip_from fd00::/56;
real_ip_header X-Real-Ip;
'';
virtualHosts.nginx-stub-status = lib.mkIf (cfg.enable && cfg.nginx.enable) {
listen = [
{
addr = "[::1]";
port = 6424;
ssl = false;
}
];
locations."/stub_status" = {
extraConfig = ''
stub_status;
'';
};
};
};
}