# Displaying Files like phpinfo.php Nginx

URL: https://sohaib.com/blog/displaying-files-like-phpinfo-php-nginx
Author: Sohaib Khan
Published: Jan 11, 2017
Updated: Sep 8, 2026
Category: Web Servers & DevOps

> Problem I was having was is basically I cannot run a simple info.php inside my publichtml after doing some research I came up with this rewrite if you've any other solution do let me know it works for me. Nginx This…

Problem I was having was is basically I cannot run a simple info.php inside my public\_html after doing some research I came up with this rewrite if you've any other solution do let me know it works for me. Nginx This is to display all files inside your /home/domain/public\_html

```nginx
location / {

location ~ ^/(.+.php)$ {
try_files $uri =404;
root $MAGE_ROOT;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
try_files $uri $uri/ /index.php?$args;
}
```
