nginx allow only index.php

upstream _php {
server unix:/var/run/php-fpm/php-fpm.sock;
}

server {
server_name 192.168.1.100;

root /path/to/root;
index index.php;

include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
location / { deny all; }
location = / { }
location = /index.php { fastcgi_pass _php; }

location /phpmyadmin/ { }
location ~ ^/phpmyadmin/.*\.php$ { fastcgi_pass _php; }
}

Leave a Reply

Your email address will not be published. Required fields are marked *