Matomo with Tomcat server

Hey!
I downloaded matomo and pasted the matomo folder in the webapps folder in the tomcat server. But when I hit the url i.e myserver:8080/matomo, a 404 error is shown.

I used - “demo.matomo.org/plugins/MultiSites/angularjs/dashboard/dashboard.directive.html (replace demo.matomo.org with your Matomo URL).” this url to check if I need to configure the server. The html page looked the same as the desired webpage.

I dont know what else to do. Could anyone help me?

Hi,

Matomo is a PHP application so you need a working PHP setup (I don’t know if tomcat can forward requests to PHP).

Maybe try setting up a simpler PHP script (e.g. simply one containing

<?php
phpinfo();

first and if this works (you see an info page), you can go on to set up Matomo).

Hey!

Thanks alot for replying!
I did what you asked me to do. I was not getting the info page.
So by this it means that php is not present in the tomcat server.

So as a solution, I need to install php separately in it or change the server. Do you know if glassfish server will work?

Hi,

I don’t know glassfish, but according to the wikipedia article it seems just like tomcat intended to run java applications.

Hi!

Will installing php separately in the tomcat server fix the issue?
My web application is built in spring. So I need to use a server like tomcat or glassfish.

Hi,

I don’t know tomcat well enought to know if it can forward requests to PHP.

But you don’t need to run Matomo with the same webserver as your web application. You could e.g. run Nginx or Apache in front of both your web app and Matomo and forward the requests to php-fpm or tomcat.

Or you could install Matomo on a completly separate webserver that has nothing to do with your web application.

Hi!

Suppose I set up matomo in apache server and run the web application I developed in tomcat, will the php requests from the tracking code be sent to matomo even though it is running on tomcat server? Will I have to download php in tomcat for it to work?

Hi,

Matomo and your webapp can run on completely different servers that have no connection to each other. The only important thing is that the browser of the website visitor can access both of them as the only connection is that your webapp adds the JS tracking code which makes the requests to Matomo via HTTPS.

Hi!

Will the tracking code work as intended if I use jsp instead of html or will there be some more configurations issues??

Hi,

What ends up in the users browsers is still (X)HTML. So as long as Javascript works, the tracking code will work.