Okay, it works if I add this:
location ^~ /folder1/admin {
auth_basic "Login";
auth_basic_user_file /var/www/domain.tld/www/folder1/admin/.htpasswd;
location ~ \.php$ {
#limit_req zone=limit burst=5 nodelay;
try_files $uri =404;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_intercept_errors off;
fastcgi_read_timeout 120;
fastcgi_buffers 256 4k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
##
# Pass PHP-Files To Socket
##
location ~ \.php$ {
#limit_req zone=limit burst=5 nodelay;
try_files $uri =404;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_intercept_errors off;
fastcgi_read_timeout 120;
fastcgi_buffers 256 4k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
But that is redundancy and can be complicated if you have many of those entries and then want to change a .php setting (you have to do it multiple times).
Isn't it possible to make it simpler?