首先要编辑nginx的虚拟主机配置,在fastcgi的location语句的前面按下面的内容添加:

location ~ /(data|uploads|templets)/.*.(php|php5)?$ {
deny all;
}