Private file storage area settings in Drupal 9.3 ($settings['file_private_path'] =)

After thorough testing, I can confirm that in this situation it is not necessary to add a block to restrict access to the private file because the access has already been restricted and returned 404. In case you still want to add a block to restrict access to this private folder as described above, I tested the below and it worked. You can either use root or alias and both worked:

## Secure access to private files
    location ^~ /private {
#   alias /var/www/example.com; ## This option also works
    root /var/www/example.com;
    internal;
    }

This should be removed from the above block because it is incorrect and did not have any effect:

location ^~ {
        internal;
        alias /var/www/example.com/private;
    }