Nextcloud:fpm with bare metal nginx

Hi, I’ve deployed a nextcolud container from nextcloud:fpm image.
I tried to serve it with bare metal nginx (which means it is on host machine)

however, I met ‘file not found’ error on a blank page.

I mounted /var/www/html(container volume) on /var/www/nextcloud (host).
and my document root is /var/www

my nginx config is almost identical to NGINX configuration — Nextcloud latest Administration Manual latest documentation except the part below

location ~ \.php(?:$|/) {
                fastcgi_split_path_info ^(.+?\.php)(/.*|)$;
                set $path_info $fastcgi_path_info;
                try_files $fastcgi_script_name =404;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
#               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_param HTTPS $https;
                fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice
                fastcgi_param front_controller_active true; # Enable pretty URLs without /index.php/
                fastcgi_pass php-handler;
                fastcgi_intercept_errors on;
                fastcgi_request_buffering off;
                fastcgi_max_temp_file_size 0; # Allow downloads > 1 GiB: https://github.com/nextcloud/documentation/pull/7979
        }

I referred Nextcloud:FPM - Primary script unknown - #8 by Razva to edit my config.

here is a part of error.log

2022/10/26 20:12:41 [debug] 649414#649414: *364 http upstream temp fd: -1
2022/10/26 20:12:41 [debug] 649414#649414: *364 http output filter "/nextcloud/index.php?"
2022/10/26 20:12:41 [debug] 649414#649414: *364 http copy filter: "/nextcloud/index.php?"
2022/10/26 20:12:41 [debug] 649414#649414: *364 http postpone filter "/nextcloud/index.php?" 00007FFD70677E30

I assume that $fastcgi_script_name is gone wrong, but I don’t know much about CGI parameters or regEx.

Any advice will be appreciated!

I’ve made a progress with the code block below,

location ~ ^/nextcloud/\.php(?:$|/) {
                fastcgi_split_path_info ^(.+?\.php)(/.*|)$;
                set $path_info $fastcgi_path_info;
                try_files $fastcgi_script_name =404;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
                fastcgi_param SCRIPT_NAME /nextcloud/$1.php;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_param HTTPS $https;
                fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice
                fastcgi_param front_controller_active true; # Enable pretty URLs without /index.php/
                fastcgi_pass php-handler;
                fastcgi_intercept_errors on;
                fastcgi_request_buffering off;
                fastcgi_max_temp_file_size 0; # Allow downloads > 1 GiB: https://github.com/nextcloud/documentatio>
        }

Now the index.php(I guess) is downloaded instead of being rendered.
What can I do further?