mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-07-04 17:51:48 +02:00
fix: put loki behind nginx proxy to hide debug/pprof endpoint and only allow push.
This commit is contained in:
@@ -3,14 +3,15 @@
|
||||
let
|
||||
cfg = config.services.loki;
|
||||
stateDir = "/data/monitoring/loki";
|
||||
internalPort = 83100;
|
||||
in {
|
||||
services.loki = {
|
||||
enable = true;
|
||||
configuration = {
|
||||
auth_enabled = false;
|
||||
server = {
|
||||
http_listen_port = 3100;
|
||||
http_listen_address = "0.0.0.0";
|
||||
http_listen_port = internalPort;
|
||||
http_listen_address = "127.0.0.1";
|
||||
grpc_listen_port = 9096;
|
||||
};
|
||||
|
||||
@@ -81,5 +82,21 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ cfg.configuration.server.http_listen_port ];
|
||||
services.nginx.virtualHosts."loki-internal" = {
|
||||
listen = [{
|
||||
addr = "0.0.0.0";
|
||||
port = 3100;
|
||||
ssl = false;
|
||||
}];
|
||||
locations = {
|
||||
"/loki/api/v1/push" = {
|
||||
proxyPass = "http://127.0.0.1:${toString internalPort}";
|
||||
};
|
||||
"/" = {
|
||||
return = "403";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 3100 ];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user