apache confのallowの後ろにコメントを書くと逆引きされる

overview

掲題の通りなので、apache confのallow/denyの後ろにコメントを書くとパフォーマンス劣化に繋がる。

内容

以下のようにconfを書いたとしても「Allow」のディレクティブが複数の値を取得する過程で、コメントをホスト名として扱ってしまう。

allow from 10.0.0.0   # comments

正しくコメントを残したければ以下のように設定する必要があった。

# comments
allow from 10.0.0.0

httpd.apache.org

Directives in the configuration files are case-insensitive, but arguments to directives are often case sensitive. Lines that begin with the hash character "#" are considered comments, and are ignored. Comments may not be included on the same line as a configuration directive. White space occurring before a directive is ignored, so you may indent directives for clarity. Blank lines are also ignored.

ドキュメントにも「#」で始まる行はコメントとして見なされ無視されると書いている。 パフォーマンス劣化を起こさないためにもコメント一つとっても気をつけないといけない。

以下、参考にした記事。

blog.nomadscafe.jp