Why not work a few location?

Good afternoon everyone.

Like not the beginner, wrote a lot of different configs for nginx, but there is a common task and "went crazy for" can't get through the second day.

There are the usual bunch of Nginx and PHP-FPM through socket.
Very simple config (here is in very simplified form, all the excess that is not relevant to the question removed)

server {

 # Want to disallow browser access to the folders in the root, beginning
 # with "_", there are scripts for processing rules
 location ~ ^/_ {
internal;
}

 # Processing any test addresses 
 location ~ "^/virtual/(.*)$" {
 try_files /_scripts/virtual.php?param=$1 /_html/404.html;
}

 # Transfer the standard php-FPM socket
 location ~ \.(php|phtml) {
 try_files $uri = 404;
 location unix:/tmp/php-fpm.sock;
 fastcgi_index index.php;
}
}


The problem: when you delete a Directive
location ~ ^/_ {
internal;
}

everything works fine, but it is worth it to include how the scripts in the folder _scripts begin to surrender to the browser in raw form. Why not work past location, because there are no structures of the type last and break all the idea of the section location should be handled, yet fall under the terms?

Thank you.
June 5th 19 at 21:10
1 answer
June 5th 19 at 21:12
Not 100% sure, but the fact is that in the second location, nginx will try to give the files found in /_scripts/...
Since the second location not specified additional parameters (in particular fastcgi) then it returns plain/text.

Find more questions by tags Nginx