Magento 2 how to configure Nginx to allow execute phpinfo.php files in root folder

Go to the Nginx  configuration then you need to edit the line similar to this line 

 

location ~ (index|get|static|report|404|503)\.php$ {

 

to be like this 

 

location ~ (index|get|static|report|404|503|phpinfo)\.php$ {

 

then restart Nginx