Grafana: Difference between revisions
imported>PaulGrandperrin m fix proxyPath url, a slash was missing at the end causing redirection loop |
imported>ShortCord m Config structure update for Grafana |
||
| Line 8: | Line 8: | ||
<syntaxhighlight lang=nix> | <syntaxhighlight lang=nix> | ||
services.grafana = | services.grafana = | ||
enable = true; | |||
# Listening | settings = { | ||
server = { | |||
# Listening Address | |||
# Grafana needs to know on which domain and URL it's running | http_addr = "127.0.0.1"; | ||
# and Port | |||
http_port = 3000; | |||
# Grafana needs to know on which domain and URL it's running | |||
domain = "your.domain"; | domain = "your.domain"; | ||
root_url = "https://your.domain/grafana/"; # Not needed if it is `https://your.domain/` | |||
}; | |||
}; | |||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 21: | Line 26: | ||
This will make Grafana available only at localhost. On a server, it might be used through SSH tunnel or made publicly available using nginx with TLS. For example the follwing [[Nginx]] configuration can be used: | This will make Grafana available only at localhost. On a server, it might be used through SSH tunnel or made publicly available using nginx with TLS. For example the follwing [[Nginx]] configuration can be used: | ||
<syntaxhighlight lang=nix> | <syntaxhighlight lang=nix> | ||
services.nginx.virtualHosts."your.domain" = { | |||
addSSL = true; | |||
enableACME = true; | |||
locations."/grafana/" = { | |||
proxyPass = "http://${toString config.services.grafana.settings.server.http_addr}:${toString config.services.grafana.settings.server.http_port}/"; | |||
proxyWebsockets = true; | |||
}; | }; | ||
}; | |||
</syntaxhighlight> | </syntaxhighlight> | ||