首页 > 其他 > 详细

nginx防止注入

时间:2015-05-13 20:00:54      阅读:225      评论:0      收藏:0      [点我收藏+]

添加蓝色部分,配置如下:

server {

        listen   80;

        server_name q1.xx.cn;

        root /kuaidihelp_sto/web/www;

        index index.php index.html index.htm;

# 注入过滤

if ($request_uri ~* "([+|(%20)]and[+|(%20)])|([+|(%20)]or[+|(%20)])|([+|(%20)]select[+|(%20)])|([+|(%20)]exec[+|(%20)])|([+|(%20)]union[+|(%20)])") {

return 404;

}

if ($request_uri ~* "(cost\()|(concat\()") {

return 404;

}

if ($query_string ~ "GLOBALS(=|[|%[0-9A-Z]{0,2})") {

return 404;

}

if ($query_string ~ "_REQUEST(=|[|%[0-9A-Z]{0,2})") {

return 404;

}

if ($query_string ~ "proc/self/environ") {

return 404;

}

if ($query_string ~ "mosConfig_[a-zA-Z_]{1,21}(=|%3D)") {

return 404;

}

if ($http_user_agent ~ "Python-urllib") {

return 404;

}

location / {


        }


        location ~ \.php$ {

                fastcgi_pass   127.0.0.1:9000;

                fastcgi_index  index.php;

                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

                include        fastcgi_params;

        }


重新加载Nginx

/usr/local/nginx/sbin/nginx -s reload


本文出自 “陨落星空” 博客,请务必保留此出处http://xiao987334176.blog.51cto.com/2202382/1651011

nginx防止注入

原文:http://xiao987334176.blog.51cto.com/2202382/1651011

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!