Nginx进阶安全规则

之前发过一些Nginx的安全规则,今天又更新了一下些!也许可能你会使用到!宝塔点击网站,配置文件添加即可!

#请求这些敏感词时跳转下载10g文件
if ($request_uri ~* "(\.gz)|(\")|(\.tar)|(admin)|(\.zip)|(\.sql)|(\.asp)|(\.rar)|(function)|($_GET)|(eval)|(\?php)|(config)|(\')|(\.bak)") {
            return 301 http://lg-dene.fdcservers.net/10GBtest.zip;
        }
#禁止下载以 XXX 后缀的文件
location ~ \.(zip|rar|sql|bak|gz|7z)$
{
   return 444;
  }
#访问链接里含有 test 直接跳转到公安网
if ($request_uri ~* test=) {
  return 301 https://www.mps.gov.cn;
}
#防止SB爬虫
if ($http_user_agent ~* (SemrushBot|python|MJ12bot|AhrefsBot|AhrefsBot|hubspot|opensiteexplorer|leiki|webmeup)) {
      return 444;
    }
#屏蔽非常见蜘蛛爬虫配置
if ($http_user_agent ~* (SemrushBot|python|MJ12bot|AhrefsBot|AhrefsBot|hubspot|opensiteexplorer|leiki|webmeup)) {
     return 444;
  }
#禁止某个目录执行脚本
#uploads|templets|data 这些目录禁止执行PHP
location ~* ^/(uploads|templets|data)/.*.(php|php5)$ {
    return 444;
  }
© 版权声明
THE END
如果喜欢,可以【点赞】【分享】【收藏】
点赞11赞赏分享
评论 抢沙发
头像
人生坎坎,山山而峦,不过尔尔;心路漫漫,水水而川,如此悠悠
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容