以前macのapache環境についてメモしたが、
デフォルトの設定ではhtmlファイルなどの置き場が
/Library/WebServer/Documents
となっており、ここではvimで新たにファイルを作成しても
書き込みパーミッションがなかったりで色々と不便。
なので、/Users/ユーザ名/Sitesあたりに設定を変更した。
会社のmacなので、OSは10.8(Mountain Lion)。
以下、その手順。
1. httpd.confを開く。
/private/etc/apache2/httpd.conf
233行目あたりのDocumentRootと
263行目あたりのDirectoryを
/Users/ユーザ名/Sites に変更する
# # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # DocumentRoot "/Users/ユーザ名/Sites" ...(中略)... # # This should be changed to whatever you set DocumentRoot to. # <Directory "/Users/ユーザ名/Sites"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews #
2. 次に、ユーザごと(?)の設定ファイルもあるので
そちらも編集。
/private/etc/apache2/users/ユーザ名.conf
同じようにDirectoryのパスを書き換えればよい。
3. apacheサーバを再起動
$ apachectl restart
これでhttp://localhostにアクセスすれば表示されるはず。
2.については実はよくわかってないんだけど、
10.8 から
システム環境設定 > 共有
に「web共有」がなくなったせいなのか
こっちのconfファイルも書き換えないとうまくいかなかった。
家のmacは10.7 Lionなので1.の手順+web共有をオン、で
うまくいったのに。
とにかく、これでdojoの勉強がしやすくなった。