Grafana and Apache

Hi,

I’m a beginner of Grafana and trying to create an URL redirection from server.domain.com:3000/login to server.domain.com/grafana in Apache.

I’m unable to open the Grafana login page. The port was changed from 3000 to 80 in grafana.ini.

Here is the Apache config file. Did I do something wrong?

<VirtualHost *:80>
    DocumentRoot /usr/share/grafana/
    ServerName server.domain.com
    RewriteEngine on
    RewriteRule ^/?$ /grafana [R=permanent,L]

    <Directory "/usr/share/grafana/">
        Require all granted
        AllowOverride All
        Options FollowSymLinks MultiViews
    </Directory>
</VirtualHost>

Not sure what you’re trying to do here, it sounds like you want to use Apache listening on port 80 as a reverse proxy.

<VirtualHost *:80>
  ServerName server.domain.com
  RewriteEngine on
  RewriteRule ^/?$ /grafana/ [R=permanent,L]
  <Location "/grafana">
    ProxyPass http://grafana.staged-by-discourse.com
  </Location>
  ProxyPassReverse /grafana http://grafana.staged-by-discourse.com
</VirtualHost>

Then in your grafana custom.ini:

[server]
http_addr = 127.0.0.1
http_port = 3000
root_url = http://server.domain.com/grafana/

That will set Grafana up to listen on port 3000 on localhost, and Apache to listen on port 80, requests to http://server.domain.com/grafana/ will get reverse proxied to Grafana, and requests to http://server.domain.com/ will get redirected to http://server.domain.com/grafana/