#解決したいこと
http://localhost/~[ユーザ名]/
でアクセスした際に、403 Forbiddenとなることを解決したいです。
#エラーが出るまでに行ったこと
https://qiita.com/kid_drill/items/5c85917068490177b6ab を参考にapacheの設定を行い、エラーも出ず描画されました。
次に、参照されるindex.htmlを別の場所のものにしようと考え、/etc/apache2/users/[ユーザ名].conf
内の<Directory "/Users/[ユーザ名]/Sites/">
の部分を<Directory "/Users/[ユーザ名]/Desktop/page">
(pageディレクトリにはindex.htmlがある)に変更しました。
また、/etc/apache2/httpd.conf
内のDocumentRoot "/Library/WebServer/Documents" <Directory "/Library/WebServer/Documents">
の部分を"/Users/[ユーザ名]/Desktop/page"
へ変更しました。
変更後apacheをリスタートすると、403 Forbiddenが表示されました。
#エラー排除のためにやったこと
エラーログを読み、権限の問題である可能性があると考えたのでUser,ユーザ名,Desktop,pageの全てのディレクトリに対してchmod a+x
コマンドを実行しました。
また、/etc/apache2/httpd.conf
内のDirectoryセクション内のRequireの部分の設定をRequire all granted
に変更しました。
#確認されるエラーログ
[Wed Feb 26 22:44:23.698154 2020] [autoindex:error] [pid 13684] [client ::1:56785] AH01276: Cannot serve directory /Users/[ユーザ名]/Sites/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive
[Wed Feb 26 22:44:23.746951 2020] [negotiation:error] [pid 13684] (1)Operation not permitted: [client ::1:56785] AH00686: cannot read directory for multi: /Users/[ユーザ名]/Desktop/page/, referer: http://localhost/~[ユーザ名]/
補足情報(FW/ツールのバージョンなど)
Mac OS 10.15.1
Server version: Apache/2.4.41 (Unix)
よろしくお願い致します。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/02/29 04:49 編集
2020/02/29 05:02
2020/02/29 05:12
2020/03/03 05:14
2020/03/07 07:56
2020/03/07 08:07
2020/03/13 08:11
2020/03/25 10:39