2016-10-21 04:01:34 -05:00
|
|
|
+++
|
|
|
|
title = "Running Grafana behind a reverse proxy"
|
|
|
|
description = "Guide for running Grafana behind a reverse proxy"
|
|
|
|
keywords = ["grafana", "nginx", "documentation", "haproxy", "reverse"]
|
|
|
|
type = "docs"
|
|
|
|
[menu.docs]
|
|
|
|
name = "Running Grafana behind a reverse proxy"
|
|
|
|
parent = "tutorials"
|
|
|
|
weight = 1
|
|
|
|
+++
|
|
|
|
|
2016-09-12 07:47:02 -05:00
|
|
|
|
|
|
|
# Running Grafana behind a reverse proxy
|
|
|
|
|
2016-10-21 04:01:34 -05:00
|
|
|
It should be straight forward to get Grafana up and running behind a reverse proxy. But here are some things that you might run into.
|
2016-09-12 07:47:02 -05:00
|
|
|
|
2016-10-21 04:01:34 -05:00
|
|
|
Links and redirects will not be rendered correctly unless you set the server.domain setting.
|
2016-09-12 07:47:02 -05:00
|
|
|
```
|
|
|
|
[server]
|
|
|
|
domain = foo.bar
|
|
|
|
```
|
|
|
|
|
2016-10-21 04:01:34 -05:00
|
|
|
To use sub *path* ex `http://foo.bar/grafana` make sure to include `/grafana` in the end of root_url.
|
|
|
|
Otherwise Grafana will not behave correctly. See example below.
|
2016-09-12 07:47:02 -05:00
|
|
|
|
2017-02-20 05:11:22 -06:00
|
|
|
## Examples
|
2016-09-12 07:47:02 -05:00
|
|
|
Here are some example configurations for running Grafana behind a reverse proxy.
|
|
|
|
|
2017-02-20 05:11:22 -06:00
|
|
|
### Grafana configuration (ex http://foo.bar.com)
|
|
|
|
|
2016-09-12 07:47:02 -05:00
|
|
|
```
|
|
|
|
[server]
|
|
|
|
domain = foo.bar
|
|
|
|
```
|
|
|
|
|
2017-02-20 05:11:22 -06:00
|
|
|
### Nginx configuration
|
|
|
|
|
2016-09-12 07:47:02 -05:00
|
|
|
```
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
root /usr/share/nginx/www;
|
|
|
|
index index.html index.htm;
|
|
|
|
|
|
|
|
location / {
|
|
|
|
proxy_pass http://localhost:3000/;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2017-02-20 05:11:22 -06:00
|
|
|
### Examples with **sub path** (ex http://foo.bar.com/grafana)
|
2016-09-12 07:47:02 -05:00
|
|
|
|
2017-02-20 05:11:22 -06:00
|
|
|
#### Grafana configuration with sub path
|
2016-09-12 07:47:02 -05:00
|
|
|
```
|
|
|
|
[server]
|
|
|
|
domain = foo.bar
|
|
|
|
root_url = %(protocol)s://%(domain)s:/grafana
|
|
|
|
```
|
|
|
|
|
2017-02-20 05:11:22 -06:00
|
|
|
#### Nginx configuration with sub path
|
2016-09-12 07:47:02 -05:00
|
|
|
```
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
root /usr/share/nginx/www;
|
|
|
|
index index.html index.htm;
|
|
|
|
|
|
|
|
location /grafana/ {
|
|
|
|
proxy_pass http://localhost:3000/;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
|