Install Grafana Behind reverse proxy
If the installation is done on a Host server then the following steps should be performed to setup grafana behind a reverse proxy.
Installation steps
To let Grafana know how to render and redirect the links correctly, in the Grafana configuration file, change
server.domain
to the domain name that will be used,
2. Restart grafana to see the changes
3. To serve grafana behind the sub path, such as http://example.com/grafana
Include the sub path at the end of the root_url.
Set serve_from_sub_path
to true.
4. Next step is to configure NGINX.
Configure NGINX
NGINX is a high performance load balancer, web server, and reverse proxy.
In the NGINX configuration file inside
http
section, add the following:
Reload the NGINX configuration
Navigate to port 80 on the machine NGINX is running on and the Grafana login page will appear.
For Grafana Live which uses WebSocket connections, raise a Nginx worker_connections option which is 512 by default – which limits the number of possible concurrent connections with Grafana Live.
Also, be aware that the above configuration will work only when the proxy_pass
value for location /
is a literal string. If you are using a variable here, read this GitHub issue and there will be a need to add an appropriate NGINX rewrite rule.
To configure NGINX to serve Grafana under a sub path, update the location
block:
Configure HAProxy
To configure HAProxy to serve Grafana under a sub path:
Configure IIS
IIS requires that the URL Rewrite module is installed.
To configure IIS to serve Grafana under a sub path, create an Inbound Rule for the parent website in IIS Manager with the following settings:
pattern:
grafana(/)?(.*)
check the
Ignore case
checkboxrewrite URL set to
http://localhost:3000/{R:2}
check the
Append query string
checkboxcheck the
Stop processing of subsequent rules
checkbox
This is the rewrite rule that is generated in the web.config
:
Check the tutorial on IIS URL Rewrites for more in-depth instructions.
Configure Traefik
Traefik Cloud Native Reverse Proxy / Load Balancer / Edge Router
Using the docker provider the following labels will configure the router and service for a domain or subdomain routing.
To deploy a subpath
Examples using the file provider,
Last updated