51 lines
1007 B
Nix
Raw Normal View History

{ config, ... }:
let
hostIP = "192.168.0.130";
in
{
services.nginx = {
upstreams = {
"grafana" = {
servers = {
"127.0.0.1:${toString config.services.grafana.settings.server.http_port}" = { };
};
};
"prometheus" = {
servers = {
"127.0.0.1:${toString config.services.prometheus.port}" = { };
};
};
};
virtualHosts."graf.matri.cx" = {
enableACME = true;
forceSSL = true;
root = "/var/www/graf.matri.cx";
locations."/" = {
proxyPass = "http://grafana";
proxyWebsockets = true;
};
};
virtualHosts.grafana = {
locations."/" = {
proxyPass = "http://grafana";
proxyWebsockets = true;
};
listen = [{
addr = hostIP;
port = 8010;
}];
};
virtualHosts.prometheus = {
locations."/".proxyPass = "http://prometheus";
listen = [{
addr = hostIP;
port = 8020;
}];
};
};
}