Magento2 Nginx to allow execute other php or wordpress in subdirectory

Firt of all you have to update the “nginx.conf.sample”,

You can find this file at magento root, so change

location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check).php$

TO

location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check|mycustomfile).php$

Here I want to run mycustomfile.php so I will place this file in “pub” directory.

After this you have to reload the nginx by runing this command on ssh
sudo nginx -s reload

Hope it will help you