添加蓝色部分,配置如下:
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