Nginx and Required Private Directories

I am setting up Matomo 4.5 on a new server with nginx.
In the System Check I am getting the error that the URLs are accessible from the internet.
I don’t understand why. When I manually request the URLs I get a 403 (forbidden)
In the FAQ the recommended solution for nginx is:

We recommend setting the same configuration as in our Nginx repository or directly using this repository to configure your Matomo installation.

This is exactly what I am doing and the config contains:

## disable all access to the following directories
location ~ ^/(config|tmp|core|lang) {
    deny all;
    return 403; # replace with 404 to not show these directories exist

So it looks to me as if the configuration is correct but I am still getting this error.