Please use the official NGINX documentation, guides and examples to start with: https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_split_path_info
Loading PHP-FPM the right way. Replace the location regex with this:
1 location ~ ^(.+\.php)(.*)$ {
Make sure you include this:
1 fastcgi_split_path_info ^(.+\.php)(.*)$;
And also this:
1 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
2 fastcgi_param PATH_INFO $fastcgi_path_info;