1、屏蔽网站测速

1.1、屏蔽 ITDOG 网站测速

https://www.itdog.cn/

关键代码:

  • 01
  • 02
  • 03
  • 04
#屏蔽所有测速模式 if ($http_checkmode) { return 403; }

配置在server节点下

  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08
  • 09
  • 10
  • 11
server { listen 80; server_name your_domain.com; #屏蔽所有测速模式 if ($http_checkmode) { return 403; } # 其他配置... }

配置后所有测速行为都会返回403状态码。

1.2、屏蔽拨测

https://www.boce.com/

关键代码:

  • 01
  • 02
  • 03
if ($http_user_agent ~* "fromBoce") { return 403; }

配置在server节点下

  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08
  • 09
  • 10
server { listen 80; server_name your_domain.com; if ($http_user_agent ~* "fromBoce") { return 403; } # 其他配置... }

配置后所有测速行为都会返回403状态码。

特殊说明:合并写法

  • 01
  • 02
  • 03
if ($http_user_agent ~* "(Uptime-Kuma|fromBoce)") { return 403; }

2、屏蔽Uptime Kuma监控

关键代码:

  • 01
  • 02
  • 03
  • 04
# 拦截Uptime Kuma的User-Agent if ($http_user_agent ~* "Uptime-Kuma") { return 403; }

配置在server节点下

  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08
  • 09
  • 10
  • 11
server { listen 80; server_name your_domain.com; # 拦截Uptime Kuma的User-Agent if ($http_user_agent ~* "Uptime-Kuma") { return 403; } # 其他配置... }

配置后Uptime Kuma监控会返回403状态码。

此时可以将403状态码加入到有效状态码列表中。