Need help for configuration with apache2 subdomain and subpath

  • What Grafana version and what operating system are you using?
  • Ubuntu 20.04.6 LTS
  • Grafana : 10.2.0

Note : _ are add in “url”

  • What are you trying to achieve?
    I try to setup grafana on a specific web (working) configuration on apache :

https_://sub.domain.com/ => an index page
https_://sub.domain.com/subpath1 => grafana
https_://sub.domain.com/subpath2 => other stuff

With tls redirection & websocket working.

And be sure my conf is valid.

ALL STUFF is behind F5 which i have no access. But error can come from that side too.
And the TLS is not currently fully setup (have a tls for domain.com i “accept” the risk).

  • How are you trying to achieve it?

Setup conf file (apache and grafana)

  • What happened?

Currently not working.

  • What did you expect to happen?
    A working configuration.

  • Can you copy/paste the configuration(s) that you are having problems with?

Directory structure :
/var/www/sub/webroot
/var/www/sub/subpath2
The apache conf :

<VirtualHost *:80>
  ServerName sub.domain.com
  DocumentRoot /var/www/sub/webroot

  RewriteEngine On
  RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/
  RewriteRule ^(.*)$ https_://%{HTTP_HOST}$1 [R=301,L]

  # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
  # error, crit, alert, emerg.
  # It is also possible to configure the loglevel for particular
  # modules, e.g.
  # LogLevel info ssl:warn
  LogLevel info

  ErrorLog ${APACHE_LOG_DIR}/error-sub.log
  CustomLog ${APACHE_LOG_DIR}/access-sub.log combined
</VirtualHost>

<VirtualHost *:443>
  ServerName sub.domain.com

  DocumentRoot /var/www/sub/webroot

  Alias /subpath2 /var/www/sub/subpath2/
  <Directory /var/www/sub/subpath2/>
     Options Indexes FollowSymLinks MultiViews
     Require all granted
   </Directory>

   <location "/sub/subpath1/" >
     ProxyPreserveHost On
     ProxyPass "http_://127.0.0.1:3000/"
     ProxyPassReverse "http_://127.0.0.1:3000/"
     RewriteEngine on
     RewriteCond %{HTTP:Upgrade} websocket [NC]
     RewriteCond %{HTTP:Connection} upgrade [NC]
     RewriteRule ^/?(.*) "ws://127.0.0.1:3000/$1" [P,L]
   </location>

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

</VirtualHost>

The relevant part of my grafana.ini

[server]
protocol = http
http_addr =
http_port = 3000
domain = sub.domain.com
enforce_domain = false
root_url = %(protocol)s://%(domain)s/subpath1
serve_from_sub_path = true
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

Only 404 error or wrong redirection apache2 side. but i probably miss something.

  • Did you follow any online instructions? If so, what is the URL?
    Not remember exact url but mostly here and official documentation.