Nginx behavior still working as is today ?

Mik J mikydevel at yahoo.fr
Sat Sep 28 18:34:42 UTC 2024


Hello,

Someone pointed this out to me

Maxim D.: The ​try_files directive changes URI of a request to the one matched on the file system, and subsequent attempt to split the URI into $fastcgi_script_name and $fastcgi_path_info results in empty path info - as there is no path info in the URI after try_files.

That was 11 years ago, is it still true ?
I use Nginx 1.24

Also, I have something like this

server {
        listen 80;

...
        location / {
          try_files $uri $uri/ /index.php$is_args$args;

...
In that location bloc I have
          location ~ ^(.+\.php)(.*)$ {
...
              fastcgi_split_path_info ^(.+\.php)(/.*)$;


I don't have any try_files in my location ~ ^(.+\.php)(.*)$ { but this bloc exist within location / {

What rule applies ?
- There shouldn't be any try_files in the same bloc ( location ~ ^(.+\.php)(.*)$ { ) for me ?
- Or even no try_files in the parent bloc
- Or even no try_files at all in the server bloc

Thank you


More information about the nginx mailing list