

推荐:《PHP教程》
1、禁止某一个目录执行php
location ~* ^/download/.*.(php|php5)$
{
deny all;
}2、禁止多个目录执行php
location ~* ^/(download|down)/.*.(php|php5)$
{
deny all;
}注意:要写在php配置前,下面是一个示例
location ~* ^/(download|down)/.*.(php|php5)$
{
deny all;
}
location ~ [^/].php(/|$)
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}