2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Apache] bot 避けのおまじない

Posted at

公開サーバーを管理していると、行儀の悪いボットやらワームやらクローラーに
サイト全体を舐め回される事があるので、そのおまじない。

Apache 以外の実装は確認していません。

Apache の仕様で、NameVirtualHost が複数定義してあって、
どの ServerName にもマッチしなかった場合、最初に定義されている
NameVirtual で処理されるのを利用します。

行儀の悪いボットは IP でアクセスしてくる事が多いので、例え1サイトしか
ホスティングして無くても NameVirtual で下記の様に設定する事で、隔離できます。

<VirtualHost *:80>
  ServerName dev.null.hoge.fuga
</VirtualHost>

<VirtualHost *:80>
  ServerName example.com
</VirtualHost>

尚、リクエストヘッダーに Host: をちゃんと付けて来るボットには効果が有りませんが
アクセスログはだいぶスッキリします。

wordpress や phpMyAdmin が無いか探しに来ているのは結構引っかかっていく模様w

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?