We are using matomo on-premise to track a few websites. In a nutshell, we use 2 different ways to interact with Matomo:
- Client makes a GET request straight to /matomo.php
- Matomo replies with a image/gif
- Client makes a GET request to a NGINX server that acts as a reverse proxy (which has max request time of 1 minute)
- The proxy passes the request to the machine where we are hosting Matomo using NGINX + PHP_FPM
- the response comes back as application/json.
While Option 1) works 99% of the times, Option 2) frequently fails due to timeouts. We have verified that the requests do reach the machine where we are hosting matomo in a timely manner, but the request is in the last step when NGINX tries to pass the request to PHP_FPM.
Some of the errors we noticed in the NGINX log are:
- “closed keepalive connection”
- “epoll_wait() reported that client prematurely closed…”
We are unable to identify the root cause. If there are any insights that you can share with me, they will be greatly appreciated.