How it is possible to deny access to a folder, but except some subfolders in it from "deny"?
I tried something like this (in this order):
#this subfolder shouldn't be denied and php scripts inside should be executable
location ~ /data/public { allow all; }
#this folder contains many subfolders that should be denied from public access
location ~ /data { deny all; return 404; }
... which doesn't work correctly. Files inside the /data/public folder are accessible (all other in /data are denied as it should be), but PHP files are not executed anymore in the /data/public folder (if I don't add these restrictions, the PHP files are executable).
What is wrong? How can it be correct? I think theres a better way to do it.
It would be very nice if anyone can help me with this :).
Thanks, but PHP files are still not executed in the /data/public/ folder, like a simple
<? echo "test"; ?>
It gives you this file as a download (without the "deny"-configuration above, the php files are working well).
My PHP Configuration:
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
PHP files in all other directories outside /data/ are working... (other subfolders as well).