Grafana를 Reverse Proxy에서 사용하기

grafana.ini 에서 다음 부분을 수정한다. root_url 에는 리버스 프록시로 제공될 주소를 적는다. 그리고 serve_from_sub_path 를 true로 변경한다. 서비스를 재시작하면 된다.

# If you use reverse proxy and sub path specify full url (with sub path)
;root_url = %(protocol)s://%(domain)s:%(http_port)s/
root_url = %(protocol)s://%(domain)s/grafana-vital/

# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons.
;serve_from_sub_path = false
serve_from_sub_path = true

리버스 프록시를 제공하는 nginx 에서 관련 설정을 추가한다.

location /grafana-vital/ {
	proxy_pass http://grafana.rcc:4000/;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header Host $host;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

index.html 을 수정한다.

<p style="font-family":'Tahoma';"><a href="grafana-vital" target="_blank">Patient Monitoring System (Current)</a></p>