だいぶ間が空いてしまいました。
MacOS Xの場合、インストール直後の状態では、apacheの設定では、
/Library/WebServer/Documents/
がルートディレクトリに設定されています。
これを使用しないようにして、自分の好きなディレクトリに設定します。
今回、TTのインストールはほとんど関係ないかも…。既にVHいじれる方、ほとんど読む必要なく…。
今回、ルートディレクトリに設定するのは、
/Users/USERNAME/Sites/htdocs/
にします。また、今後のことを考えて、
/Users/USERNAME/Sites/etc/USERNAME.conf
を作成し、ここにVHの設定を記述します。
他のディレクトリにされる方は、適宜読み替えてください。
まず、USERNAME.confを作成します。
$ cd ~/Sites/
$ mkdir etc
$ cd etc
$ pico USERNAME.conf
以下を書きます。
<VirtualHost *>
DocumentRoot /Users/USERNAME/Sites/htdocs/
CustomLog "/private/var/log/httpd/USERNAME_access_log" common
ErrorLog "/private/var/log/httpd/USERNAME_error_log"
</VirtualHost><Directory "/Users/USERNAME/Sites/htdocs/">
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
書いたら保存。
次に、httpd.confを書き換えます。
$ sudo pico /etc/httpd/httpd.conf
以下の行の頭に#を入れます。
いろんなところにバラバラに書かれていますので、がんばって探してください。
1.
DocumentRoot "/Library/WebServer/Documents"
2.
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
3.
<Directory "/Library/WebServer/Documents">〜</Directory>までで、#のついていない行全部
4.
Alias /manual/ "/Library/WebServer/Documents/manual/"
5.
<Directory "/Library/WebServer/Documents/manual">
Options Indexes FollowSymlinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
6.
ScriptAlias /cgi-bin/ "/Library/WebServer/CGI-Executables/"
7.
<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
8.
Include /private/etc/httpd/users/*.conf
で、最後に以下を書き加えます。
Include /Users/USERNAME/Sites/etc/USERNAME.conf
ファイルを準備しておきます。多分、ほとんどの人が~/Sites/にhtmlファイルがあるので、それを移植しておきます。
$ cd ~/Sites/
$ mv images/ htdocs/images/
$ mv index.html htdocs/
confファイルをチェック。
$sudo apachectl configtest
OKなら再起動。
$sudo apachectl restart
ブラウザで確認。
http://localhost/
表示されたらOK!
次回は核心?のApache::Templateをインストール、そして上記で作成したVHを用いてcgi無しでTTを使えるようにしてみましょう。