if you use the official Nginx config (nginx.conf.sample
file in the Magento 2 distribution) then you need change the line 109 from :
location ~ (index|get|static|report|404|503).php$ {
to :
location ~ (index|get|static|report|404|503|phpinfo).php$ {
and place phpinfo.php
to the pub
subfolder because pub
declared as document root at line 21:
root $MAGE_ROOT/pub;
I use my own Nginx config for Magento 2 and it permits phpinfo.php
in the root folder.