HTTPS for Grafana doesnt work / Apache

Hello,

i have running Grafana and Kibana for other purposes on the same server. I have configured an apache2. The certificates are from letsencnrypt. I dont get grafana in https running and i dont know why. Thats my settings:

#################################### Server ####################################
[server]

Protocol (http, https, socket)

protocol = https

The ip address to bind to, empty will bind to all interfaces

;http_addr =

The http port to use

http_port = 3000

The public facing domain name used to access grafana from a browser

domain = apm.domain.de

Redirect to correct domain if host header does not match domain

Prevents DNS rebinding attacks

;enforce_domain = false

The full public facing url you use in browser, used for redirects and emails

If you use reverse proxy and sub path specify full url (with sub path)

root_url = https://apm.domain.de:3000

Log web requests

;router_logging = false

the path relative working path

;static_root_path = public

enable gzip

;enable_gzip = false

https certs & key file

cert_file =/etc/letsencrypt/live/apm.domain.de/cert.pem
cert_key =/etc/letsencrypt/live/apm.domain.de/privkey.pem

Unix socket path

;socket =

Thats the Apache config:

    <VirtualHost *:443>
            ServerAdmin webmaster@localhost
            ServerName apm.domain.de
            ServerAlias apm1.domain.de

            DocumentRoot /var/www/html

            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined

            ProxyRequests Off
            ProxyPreserveHost On
            RequestHeader set X-Forwarded-Proto https
            RequestHeader set X-Forwarded-Port 443

            <Proxy *>
                    Require all granted
            </Proxy>

            ProxyPass / https://apm.domain.de:3000/
            ProxyPassReverse / https://apm.domain.de:3000/

            SSLEngine on
            SSLCertificateKeyFile   /etc/letsencrypt/live/apm.domain.de/privkey.pem
            SSLCertificateFile      /etc/letsencrypt/live/apm.domain.de/fullchain.pem


            <FilesMatch "\.(cgi|shtml|phtml|php)$">
                            SSLOptions +StdEnvVars
            </FilesMatch>
            <Directory /usr/lib/cgi-bin>
                            SSLOptions +StdEnvVars
            </Directory>

    </VirtualHost>

you can see this post

Hello Daniel,

thanks for your answer. I had change the root_url now to https://apm.domain.de without port 3000 but it doesnt work. Grafana is starting but wirhout https.

I am very sorry, I would like to help you more, but I have never worked with Apache
:pensive:

looking a little,
I think you should make the following changes

grafana

protocol = http
root_url = https://apm.domain.de

Apache

ProxyPass / http://grafana.staged-by-discourse.com/
ProxyPassReverse / http://grafana.staged-by-discourse.com/

I do not know if you have to make more changes in Apache, but I think at least these should be done.