取消nginx上传目录php执行权限 不指定

zzh , 2010/08/10 16:06 , 网站服务器 » nginx , 评论(0) , 阅读(2358) , Via 本站原创 | |

将以下代码添加至Server容器中的合适位置,也就是在定义fastcgi的规则之前.

location ~* ^/upload/.*\.(php|php5)$
{
deny all;
}

下面给个目前Sino Unix™论坛的部分nginx配置

server
{
listen 80;
server_name bbs.sinounix.com;
index index.php index.htm index.html;
location ~* ^/sudata/.*\.(php|php5)$
{
deny all;
}
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
root /var/www/Discuz/;
}