Please use the official NGINX documentation, guides and examples to start with: https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/

Loading PHP-FPM the right way. Replace the location regex with this:

location ~ [^/]\.php(/|$) {

Make sure you include this, for the WebDAV/API FileRun to work fine:

fastcgi_split_path_info ^(.+?\.php)(/.*)$;

And also this:

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;