Я попытался сохранить как можно больше оригинального поведения, попробуйте следующее:
map $uri $maybe_slash {
~/$ '';
default '/';
}
server {
...
location / {
try_files $uri @check_index;
}
location @check_index {
if ( -f $document_root$uri${maybe_slash}index.php ) { return 301 $uri${maybe_slash}index.php; }
# if we also need to check for "index.html", uncomment next line
# if ( -f $document_root$uri${maybe_slash}index.html ) { return 301 $uri${maybe_slash}index.html; }
return 301 /index.php;
}
...
}