Running Matomo in a subfolder

I’ve just installed Matomo on my Raspberry Pi. The configuration is not quite standard. I have to tunnel a subdomain through Cloudflare. The webroot for this subdomain is /var/www/html/. I installed Matomo in /var/www/html/matomo/ and everything works fine with the URL subdomain com / matomo. I created a second subdomain that is mapped to /var/www/html/somefolder/ and installed Matomo in /var/www/html/subdomain2/matomo/. This does not work at all for subdomain2 com / matomo. The installation starts, but JS and CSS files are not loaded. This is strange, since the network tab in developer tools shows correct URLs. I can copy an URL and open it without any problems. But still it is blocked when installing Matomo. It seems that there is some problem with the “virtual“ webroot for the second subdomain. Trusted domains where, of course, set correctly in the config file. The subdomain configuration on the Pi works perfectly fine. I checked it with some other application. This is why I assume that this might be a Matomo problem.

Thank you!

Server Webroot: /var/www/html/

Your configuration:


/var/www/html/matomo/ [Matomo1 Software]

subdomain.com/var/www/html/

subdomain.com/matomo//var/www/html/matomo/ [Matomo1 Instance]


/var/www/html/subdomain2/matomo/ [Matomo2 Software]

subdomain2.com/var/www/html/somefolder/

subdomain2.com/matomo/var/www/html/somefolder/matomo/ [empty]


With this configuration it is possible to request the Matomo2 Instance only with the first domain:

subdomain.com/subdomain2/matomo//var/www/html/subdomain2/matomo/ [Matomo2 Instance]


But the second domain is mapped in a empty folder.


For a installation in subfolders, the Matomo root must be configurated.

root: /

or

root: /matomo/

or

root: /matomo/somefolder/