System check config.ini.php

How to fix this issue in the system check / system report:

Überprüfung der URL https://something.de/config/config.ini.php ist fehlgeschlagen: curl_exec: Connection timed out after 2002 milliseconds. Hostname requested was: something.de
Überprüfung der URL https://something.de/tmp/cache/tracker/matomocache_general.php ist fehlgeschlagen: curl_exec: Connection timed out after 2001 milliseconds. Hostname requested was: something.de
Alle privaten Verzeichnisse sind nicht aus dem Internet zugänglich.

Suggestions:

  1. Test if your server resolves its own hostname correctly by running this commands on the server’s terminal: nslookup something.de or dig something.de.
    If DNS resolution fails, consider adjusting the server’s /etc/hosts file to map something.de to 127.0.0.1 or the local IP address. This will make sure the server can resolve its own domain locally.

  2. Ensure that your server is not blocking curl requests. Sometimes firewalls can prevent outgoing HTTP/HTTPS connections, especially if they’re meant for internal use. Double-check that your server allows outgoing connections to its own hostname or loopback (127.0.0.1).

  3. The error may be related to the curl configuration on your server. To test curl directly, run the following command from the terminal: curl -I https://something.de/config/config.ini.php
    If curl times out, it confirms there is a connectivity issue. Test whether using localhost instead of the domain name works (try curl -I https://localhost/config/config.ini.php).

  4. The timeout error indicates that curl is waiting only 2 seconds (2001/2002 milliseconds) for the connection. You could increase this timeout limit by adding a custom setting in config.ini.php under the [General] section:

[General]
http_client_timeout = 10

Thank you. In my case i run matomo via the official matomo docker container.

I have no knowledge about matomo for docker, but I know that in general container network configuration can be a problem source when trying to access an internal ressource using an external name. I had that in other cases myself which I solved using a reverse proxy. whatever this info might do for you.

Thanks for the input! I agree that container network configurations can often cause issues when trying to access internal services via external names. I’ve encountered similar problems before, and using a reverse proxy like Nginx or Traefik could be a good solution to handle traffic routing and resolve DNS name resolution issues. I’ll try configuring a reverse proxy in front of the Matomo container and see if that improves access. Appreciate the suggestion!

I fixed the container network and created a dedicated network for the matomo containers in the compose files

networks:
- matomo-network
plus assigning fixed ip addresses
networks:
matomo-network:
driver: bridge
ipam:
config:
- subnet: 172.18.0.0/16

in nginx i have the following rules defined

Disable all external access to the following directories

location ~ ^/(config|tmp|core|lang) { 
    satisfy any;
    allow 127.0.0.1;
    allow 172.18.0.0/16;  # Allow internal network access
    allow 172.19.0.0/16;  # Allow internal access from other network as well
    deny all;
    return 403; # Replace with 404 to not show these directories exist 
} 

and in the matomo docker container, i also fixed the apache settings

<Directory /var/www/html/config/>
Options FollowSymLinks
AllowOverride None
Require ip 127.0.0.1
Require ip 172.18.0.0/16

<Directory /var/www/html/tmp/>
Options FollowSymLinks
AllowOverride None
Require ip 127.0.0.1
Require ip 172.18.0.0/16

<Directory /var/www/html/lang/>
Options FollowSymLinks
AllowOverride None
Require ip 127.0.0.1
Require ip 172.18.0.0/16

Additionally I heavily increased all timeout settings.

With all these modifications i can access the files within the docker container, which is good but the matomo system check still has the same issue

url_exec: Connection timed out after 2001 milliseconds. Hostname requested was: statistics.domainname.com

I have no clue what else I can try to fix this issue