Java项目总是有一大堆php路径请求,所以直接通过Nginx拦截所有php路径请求
# 拦截所有WordPress相关路径,所有含.php路径
location ~* (wp-(login|admin|content|json|includes|cron|mail|signup|config)|\.php$) {
return 444;
}
# 拦截常见恶意 UA(不区分大小写)
if ($http_user_agent ~* "(bot|crawl|spider|scan|nmap|masscan|zgrab|sqlmap|nikto|dirbuster|gobuster|wfuzz|hydra|metasploit|python-requests|curl/|wget/|libwww-perl|java/|go-http-client)") {
return 444;
}
# 拦截空 UA(大量恶意工具不带 UA)
if ($http_user_agent = "") {
return 444;
}