サーバーレベルブロックのメリット
Nginx・ApacheでAIボットをブロックすることで、アプリケーションコード(WordPressやNext.js)にリクエストが到達する前に処理できます。不要な処理が省かれるため、サーバーリソースの節約になります。
Nginx設定
# /etc/nginx/conf.d/ai-bot-block.conf
map $http_user_agent $is_ai_bot {
default 0;
~*GPTBot 1;
~*OAI-SearchBot 1;
~*ChatGPT-User 1;
~*ClaudeBot 1;
~*anthropic-ai 1;
~*PerplexityBot 1;
~*Google-Extended 1;
~*Bytespider 1;
~*CCBot 1;
~*cohere-ai 1;
~*YouBot 1;
~*Diffbot 1;
~*Amazonbot 1;
~*MistralBot 1;
}
server {
# ...
if ($is_ai_bot) {
return 403;
}
}
NginxでHTTP 402を返す(Tollgate)
if ($is_ai_bot) {
add_header Content-Type application/json;
return 402 '{"error":"License required","url":"https://monitor.microforge.works/pricing"}';
}
Apache .htaccess設定
SetEnvIfNoCase User-Agent "GPTBot" ai_bot
SetEnvIfNoCase User-Agent "OAI-SearchBot" ai_bot
SetEnvIfNoCase User-Agent "ClaudeBot" ai_bot
SetEnvIfNoCase User-Agent "anthropic-ai" ai_bot
SetEnvIfNoCase User-Agent "PerplexityBot" ai_bot
SetEnvIfNoCase User-Agent "Google-Extended" ai_bot
SetEnvIfNoCase User-Agent "Bytespider" ai_bot
SetEnvIfNoCase User-Agent "CCBot" ai_bot
<RequireAll>
Require all granted
Require not env ai_bot
</RequireAll>
アクセスログで確認
# Nginxログでのブロック確認
grep "403" /var/log/nginx/access.log | grep -i "gptbot|claudebot|perplexitybot"
# 日次AIアクセス集計
grep -i "gptbot|claudebot|perplexitybot" /var/log/nginx/access.log | awk '{print $1}' | sort | uniq -c | sort -rn
AI Access Monitorで精緻な分析を
Nginx/Apacheのログ解析は手動では限界があります。AI Access Monitorを導入することで、リアルタイムの可視化・Bot種別分析・推定価値計算を自動化できます。