Apacheの「AH00132: file permissions deny server access」


環境

  • OSX
  • XAMPP-OSX 7.2.31 Rev.1
  • Apache 2.4.43

症状

XAMPPではxamppfiles/htdocsがデフォルトでApacheのDocumentRootなのですが、

デフォルト
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">

毎度このhtdocs
・プロジェクト毎にリネーム
・Gitでクローンしたディレクトリに全てC&Pしてコミット
するという作業が非効率に感じてきたので、ローカルのApache on XAMPPを作業ディレクトリの方に持ってきたかった。
DocumentRootを例えば

DocumentRoot "/Users/<user>/Documents/Projects"
<Directory "/Users/<user>/Documents/Projects">

に持ってこられれば、そのまま作業ディレクトリにサーバを立てられるので上記二つの作業オーバーヘッドを減らせる。
と考えたので変更してみると

だと思った。

DocumentRootの変更

変更前
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"

<Directory "/Applications/XAMPP/xamppfiles/htdocs">
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride All
    Require all granted
</Directory>
変更後
DocumentRoot "/Users/<user>/Documents/Projects"

<Directory "/Users/<user>/Documents/Projects">
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride All
    Require all granted
</Directory>

やったこと

とりあえず、ログを確認。
横長で見辛いので適度に改行してます。

[core:error] [pid 18609] 
(1)Operation not permitted: [client ::1:54134] 
AH00132: file permissions deny server access: 
/Users/<user>/Documents/Projects/index.html

テスト用に$ echo "Hello" > /Users/<user>/Documents/Projects/index.htmlで作成したフォルダへの権限がないみたいなので、

index.htmlに対して

$ chmod 755 /Users/<user>/Documents/Projects/index.html
$ chmod +x /Users/<user>/Documents/Projects/index.html

したんですが、症状は変わらず。

親ディレクトリ&index.html全てオープンな権限にしてみるも、症状変わらず。

httpdを実行しているapacheユーザであるdaemonid

$ id daemon
uid=1(daemon) gid=1(daemon) groups=1(daemon),12(everyone),61(localaccounts),
100(_lpoperator),701(com.apple.sharepoint.group.1)

特に問題はなさそうです。

他症状

httpdのログを閲覧しているとXAMPPがフリーズしてしまう。

解決方法

不明。

httpd.confDirectoryの設定は間違ってなさそう、というか元々htdocsだった際のものをディレクトリだけ書き換えたものなので動かないはずがない。

そもそも、httpd.confで拒否されていたら

AH01630: client denied by server configuration

だろうし。

なぜ権限を全て与えているのに閲覧不可なのか。。。

解決には至りませんでしたが、情報源が少なかったので書いてみました。
原因わかりそうな方、コメント欄にお願いします。