[Resolve] Grafana ApacheHTTP url

Hello,

I have an issue with the configuration of ApacheHttp with grafana. Actually Grafana is install on a Windows server and we aces it by the url : http://[serverName]:[GrafanaPort].
I have install a Apache server in order to change the grafana url to http://[serveurName]/grafana.

actually I put this in the httpd-vhosts.conf of the apache :

ProxyPreserveHost On
ProxyRequests On
ServerName http://[serverName]
ServerAlias [serverName]
ProxyPass /grafana http://localhost:[GrafanaPort]/login
ProxyPassReverse /grafana http://localhost:[GrafanaPort]/login

and when I try to reach the url http://[serveurName]/grafana those requests fail, and lead my to these screen:

GET http://[serverName]/public/css/fonts.min.css [HTTP/1.1 404 Not Found 10 ms]
GET http://[serverName]/public/css/grafana.dark.min.css [HTTP/1.1 404 Not Found 14 ms]
GET http://[serverName]/public/app/boot.js [HTTP/1.1 404 Not Found 24 ms]
GET http://[serverName]/public/app/boot.js [HTTP/1.1 404 Not Found 7 ms]

those requests don’t fail when I use the url http://[serverName]:[GrafanaPort]

GET http://[serverName]:[grafanaPort]/public/css/fonts.min.css [HTTP/1.1 304 Not Modified 3 ms]
GET http://[serverName]:[grafanaPort]/public/css/grafana.dark.min.css [HTTP/1.1 304 Not Modified 5 ms]
GET http://[serverName]:[grafanaPort]/public/app/boot.js [HTTP/1.1 304 Not Modified 6 ms]
GET http://[serverName]:[grafanaPort]/public/img/grafana_icon.svg [HTTP/1.1 304 Not Modified 3 ms]

Did some one know how to correctly configure Apache to allow the url http://[serveurName]/grafana to work?

What does your Grafana config look like?

Initialy I had only the http_port which was define, this morning I did a test with this:

http_port = [GrafanaPort]
domain = [serveurName]
root_url = http://localhost/grafana

but I succeed nothing.

Is this url correct? Should it not be http://grafana.staged-by-discourse.com/grafana ? (where 3000 is your GrafanaPort).

you are right, it works. So this is the final configuration:

for apache: httpd-vhosts.conf

<VirtualHost *:80> ProxyPreserveHost On ProxyRequests On ServerName http://[serveurName] ServerAlias [serveurName] ProxyPass /grafana http://localhost:[GrafanaPort] ProxyPassReverse /grafana http://localhost:[GrafanaPort] </VirtualHost>

for grafana: custom.ini

[server]
http_port = [GrafanaPort]
domain = [serveurName]
root_url = http://localhost:[GrafanaPort]/grafana

Thank :slight_smile:

1 Like