How to Block AI Crawlers, Junk SEO Spiders, and Empty User Agents on Nginx

My site was burning through bandwidth every day. Once I went through the server logs, the reason was obvious: most of that traffic came from worthless junk spiders, AI crawlers, and every flavor of SEO scraper.

These crawlers don't bring a site anything of value. They just keep eating bandwidth and server resources, slow down page loads, and can even get in the way of real visitors. The most direct fix, and the one that gets at the root, is to block them outright.

What I can't do is block real users, or Baidu, Google, and Bing. So I put together a set of rules aimed specifically at the usual junk spiders and the useless AI crawlers. Bookmark it or repost it if it's useful.

Nginx config (BT Panel example)

Where: Website → your site → Settings → Pseudo-static

# 1. Block AI Crawlers
if ($http_user_agent ~* "GPTBot|ChatGPT|ClaudeBot|Anthropic|OpenAI|Perplexity|PPLX|Google-Extended|Applebot-Extended|Amazonbot") {
    return 403;
}

# 2. Block Spam SEO Bots and Scrapers
if ($http_user_agent ~* "AhrefsBot|SemrushBot|MJ12bot|DotBot|BLEXBot|Webdup|Ezooms") {
    return 403;
}

# 3. Block Empty or Abnormally Short User Agents (port scanners, malicious hits)
if ($http_user_agent ~* "^$|^.{0,5}$") {
    return 403;
}

Pair it with robots.txt rules

# AI Crawlers
User-agent: GPTBot
Disallow: /
User-agent: OAI-SearchBot
Disallow: /
User-agent: ChatGPT-User
Disallow: /
User-agent: ClaudeBot
Disallow: /
User-agent: anthropic-ai
Disallow: /
User-agent: PerplexityBot
Disallow: /
User-agent: PPLX-*
Disallow: /
User-agent: CCBot
Disallow: /
User-agent: Google-Extended
Disallow: /
User-agent: Applebot-Extended
Disallow: /
User-agent: Amazonbot
Disallow: /
User-agent: YouBot
Disallow: /
User-agent: ByteDance
Disallow: /
User-agent: cohere-ai
Disallow: /
User-agent: Claude-Web
Disallow: /

# Spam / Junk Crawlers
User-agent: AhrefsBot
Disallow: /
User-agent: SemrushBot
Disallow: /
User-agent: MJ12bot
Disallow: /
User-agent: DotBot
Disallow: /
User-agent: BLEXBot
Disallow: /
User-agent: Webdup
Disallow: /
User-agent: Ezooms
Disallow: /
User-agent: ScreamingFrog
Disallow: /
User-agent: SeznamBot
Disallow: /
User-agent: PetalBot
Disallow: /
User-agent: AspiegelBot
Disallow: /
User-agent: Go-http-client
Disallow: /

# Legitimate Search Engine Bots
User-agent: Baiduspider
Allow: /
User-agent: Googlebot
Allow: /
User-agent: Bingbot
Allow: /
User-agent: Googlebot-Image
Allow: /
User-agent: Bingbot-Image
Allow: /
User-agent: *
Crawl-delay: 5
Allow: /

Save it as robots.txt and drop the file in the site's root directory. To test, open https://your-domain/robots.txt — if it loads, the rules are live.

The crawlers in detail: who runs them, what they do, why they're blocked

1. AI crawlers (training and AI search — pure resource drain, no real visitors)

User-AgentCompany / projectWhat it doesWhy it's blocked
GPTBot, ChatGPT-User, OAI-SearchBotOpenAI (US)Crawls the open web to train the ChatGPT model family and power AI searchHigh-concurrency crawling that eats bandwidth and server resources; the content feeds commercial AI training and never sends a real visitor back
ClaudeBot, anthropic-ai, Claude-WebAnthropic (US)Collects training data for the Claude model familyPure resource consumption with no visitor conversion, at a high crawl rate that loads up the server
PerplexityBot, PPLX-*Perplexity AI (US)AI search engine crawler that answers questions and serves results from web contentEnormous request volume, data-only grabbing, no effective users sent to the site
CCBotCommon Crawl (open-source project)Archives web pages at scale and underpins most of the world's AI modelsBroad and frequent crawling from a base-layer AI data source with no commercial or visitor value at all
Google-ExtendedGoogleCollects training content specifically for GeminiSeparate from the regular search crawler; it serves AI training only, produces no search traffic, and generates a lot of wasted requests
Applebot-ExtendedAppleScrapes training data for Apple IntelligenceA commercial-AI-only crawler: consumes resources, refers no traffic
AmazonbotAmazonData collection bot for Amazon's AI operationsPure data scraping with no real visitors, consuming server resources
cohere-aiCohere AI (Canada)Collects training data for a major commercial model abroadHigh-frequency crawling that serves only its own AI business, with zero return for the site
YouBotYou.comAI search engine crawlerCrawls pages purely for AI retrieval; refers almost nothing and makes up a large share of junk traffic
ByteDanceByteDanceCollects data for its AI products (Doubao, the content recommendation models, and so on)Heavy concurrent access, mostly background data collection rather than genuine users

2. Junk SEO and site-analysis spiders (third-party tools for competitor research and statistics)

User-AgentCompany / projectWhat it doesWhy it's blocked
AhrefsBotAhrefs (a leading SEO tool vendor)Backlink, keyword ranking, authority, and competitor analysisExtremely aggressive crawling with huge daily request counts, generating commercial analytics data and no visitors
SemrushBot, BLEXBotSemrush (a well-known SEO marketing tool)Traffic, index coverage, keyword, and competitor monitoringHigh-frequency polling, purely tool-driven access with no conversion value that burns a lot of bandwidth
MJ12botMajesticBacklink lookup and domain-authority analysisWidely regarded as a brute-force crawler that often ignores robots.txt and hammers sites, easily spiking server load
DotBotRaven Tools / MozAll-in-one site owner SEO analysisPeriodically bulk-crawls pages for third-party statistics — junk traffic
ScreamingFrogScreaming FrogFull-site crawling, SEO audits, page scrapingOften used to bulk-harvest every link and page on a site, firing masses of requests from a single IP in a short window — a real scraping risk
SeznamBotSeznamSmall Czech search engineA niche engine abroad with virtually no local visitors, yet it crawls constantly; the return is far below the resource cost
PetalBot, AspiegelBotHuawei Petal SearchHuawei's search engine crawlerLow market share, very few real visitors, and a high crawl rate — terrible value for the resources

3. Scrapers and scanners (malicious harvesting, vulnerability scans, automated tools)

User-AgentTypeWhat it doesWhy it's blocked
Webdup, EzoomsGeneric scraping toolsCopying an entire site, bulk-article scraping, building mirror sitesStraight-up theft of original content — malicious infringement that also floods the server with junk requests
Go-http-clientGeneric open-source HTTP libraryThe default UA for vulnerability scanners, port probes, malicious scripts, and automated attack toolsThis UA almost always means a scanner or malicious test program rather than a genuine visit — a security risk
Empty UA / 1–5 character UAVarious scanners, malicious tools, traffic-inflation scriptsAnonymous bulk site scanning, stress testing, malicious accessNo legitimate client identity; the classic signature of network scanning, CC attacks, and malicious crawlers, and it has to be blocked

4. Legitimate search engines allowed through (they bring real visitors, so they keep crawl access)

User-AgentOperatorNotes
Baiduspider, Baiduspider-ImageBaiduThe main search engine in mainland China, bringing substantial organic search traffic and indexing pages normally
Googlebot, Googlebot-ImageGoogleThe world's leading search engine, serving overseas traffic and crawling pages in full compliance
Bingbot, Bingbot-ImageBingMicrosoft's search engine, sending search traffic with well-behaved crawling

For the many operators who play dirty, blocking IP ranges is the only option left.

A few notes:

  1. What robots.txt is: an industry good-faith agreement. Legitimate AI and SEO crawlers respect it; malicious scanners and scrapers ignore it outright, which is why you need Nginx/IIS rules to enforce the block.
  2. The logic behind the blocklist: every UA above shares one trait — it only consumes bandwidth and CPU and never produces real users or business value.
  3. Crawl-delay: 5: throttles unknown crawlers to one request every five seconds, easing sudden spikes in traffic.

Leave a Comment

Comments 2

  • 长眉
    长眉 2026-11-07 15:54 Reply

    现在的AI爬虫太讨厌了。防不胜防啊

  • 秋风于渭水
    秋风于渭水 2026-06-12 20:22 Reply

    前边 Nginx 已经全给都403了,爬虫根本就看不到 robots.txt 里的规则吧。
    GPT和谷歌等会遵守robots.txt的爬虫不要拦截,只拦截不听 robots.txt 的爬虫会好一点。

Table of Contents