Failed to install script : Could not find PHP version for /usr/home/domain-name/public_html/

SYSTEM INFORMATION
OS type and version Ubuntu 22.04.1
Webmin version 1.999
Virtualmin version 7.1-1
Related packages LEMP - FPM

Hello guys,
Never realized why I couldn’t use the Install Script. When Install Script is executed just after Virtual Server creation, it works. But, after some modification, cannot install it anymore. The message output is always: Failed to install script : Could not find PHP version for /usr/home/domain-name/public_html/.

Also, the PHP Configuration under Virtualmin > Services disappears.

I detected the problem: when I create a server block in Nginx for redirection (http to https), there is no PHP instructions (fastcgi_pass …) inside it. So, Virtualmin doesn’t recognize a PHP for this server.

So, every server block need a PHP instruction. Here is the final code for nginx
/etc/nginx/sites-available/domain.com.conf

server {
	listen x.x.x.x:80;
	listen [xxxx:xxxx::xxxx:xxxx:xxxx:xxxx]:80;
	server_name domain.com www.domain.com;	
	return 301 https://domain.com.br$request_uri;
	location ~ "\.php(/|$)" {
		try_files "$uri" "$fastcgi_script_name" =404;
		fastcgi_pass unix:/var/php-fpm/XXXXXXXXXXXXXX.sock;
	}
}
server {
	server_name domain.com;
	listen x.x.x.x:443 ssl http2;
	listen [xxxx:xxxx::xxxx:xxxx:xxxx:xxxx]:443 ssl http2;
	...
	(default server config)
	...

After the change, restart Nginx, PHP-FPM and webmin.

This change is only cosmetic, since no PHP is touched in the first server block. It would be great if Virtualmin detected the PHP automatically.

Hope it helps everyone with this same problem.
Thank you