デフォルトの .htaccess を Apache 2.4 用の設定に変更する

メッセージ

デフォルトで含まれている .htaccess のアクセス制御設定が Apache 2.2 向けの設定になっている。

例 (skin/.htaccess):

<FilesMatch "\.(skin\.php)$">
        Order allow,deny
        Deny from all
</FilesMatch>

これを Apache 2.4 での設定に変更する。

例: (skin/.htacces):

<FilesMatch "\.(skin\.php)$">
  Require all denied
</FilesMatch>

Apache 2.4 でも mod_access_compat モジュールが有効な環境では2.2の記述で動作する。 であるが、 mod_access_compat は非推奨であり、 また Apache 2.2 自体が 2017年12月にサポート切れになっていることから、 デフォルトは Apache 2.4 のものに変更するべきである。

As previously announced, the Apache HTTP Server Project has discontinued all 
development and patch review of the 2.2.x series of releases.

The Apache HTTP Server Project had long committed to provide maintenance 
releases of the 2.2.x flavor through June of 2017. The final release 2.2.34 was 
published in July 2017, and no further evaluation of bug reports or security 
risks will be considered or published for 2.2.x releases.

対象ファイル

.htaccess
attach/.htaccess
backup/.htaccess
cache/.htaccess
counter/.htaccess
diff/.htaccess
lib/.htaccess
plugin/.htaccess
skin/.htaccess
wiki.en/.htaccess
wiki/.htaccess

Apache 2.2 で 新設定を使った場合の動作

PukiWiki では主に (内部のファイルにアクセスされないため) Require all denied が使われている。

Apache 2.2 でも mod_auzhz_host が存在するため、 denied対象のファイルにアクセスされなければエラーは起きず、PHPも実行される。 例えば index.php にもアクセスでき、PukiWiki 動作に影響はない。

"denied"の対象ファイル、例えば skin/pukiwiki.skin.php にアクセスしようとすると、 Internal Server Error が返される。実際に発生しているエラーは以下のもの。

configuration error:  couldn't perform authentication. AuthType not set!: /skin/pukiwiki.skin.php

正常系アクセスには影響がないため Apache 2.2 の環境でも結果として問題ない。




トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2020-01-31 (金) 02:06:29
Site admin: PukiWiki Development Team

PukiWiki 1.5.4+ © 2001-2022 PukiWiki Development Team. Powered by PHP 8.2.12. HTML convert time: 0.204 sec.

SourceForge