MacのApacheでドキュメント以下にindex.phpを設置
Apacheで任意の場所に作業フォルダを設置したい。
index.htmlやindex.phpをDocument以下の任意のフォルダにおいて作業したい時。
Macには元からApacheが入っていた気がした。
作業フォルダを任意の場所に変更する
「/etc/apache2/httpd.conf」で以下の二箇所を変更する。
今回は、"/Library/WebServer/Documents" → ”/Users/takuma/Documents/study”
に変更してみます。
$ sudo emacs /etc/apache2/httpd.conf //以下の変更。 237: DocumentRoot "/Users/takuma/Documents/study" 239: <Directory "/Users/takuma/Documents/study">
これでlocalhostにアクセスしたらいけると思ったけど、エラーがでる場合がある。
Forbiddenエラー
「You don't have permission to access / on this server.」
てな感じのエラーが出たので、以下で対応