I have a Debian 11 web server that is setup with the Matomo analytics PHP software. In the site's configuration I have these lines:
<Files "*">
Require ip 192.168.0.0/24
</Files>
<FilesMatch "(^piwik\.(php|js)|^matomo\.(php|js)|^container_.*\.js|robots\.txt|optOut.js|favicon\.ico)">
Require all granted
</FilesMatch>
Alias "/csp" "/www/vhosts/csp"
<Directory /www/vhosts/csp>
DirectoryIndex index.php
Require all granted
</Directory>
This is just a snippet. I also have a alias (/csp
) with a few PHP files for a specific job. My problem is that I cannot access this alias outside the allowed IP range (192.168.0.0/24
), although I have (in theory) added the directives for this (Require all granted
) in the last Directory
section. The /www/vhosts/csp directory resides outside Matomo's directory (thus, the Alias
).
Inside the 192.168.0.0/24
network everything is fine. Accessing the /csp
alias outside the network is not allowed (Forbidden because of client configuration).
How can I allow any host to access the /csp
alias? Commenting out the first Files
directive allows access to /csp
, but is not what I wan (I don't want the other Matomo files to be accessible from any host).