httpd.confに手を加えず、DocumentRootを変更する方法。


httpd.confからincludeされているディレクトリに新しく設定ファイルを作成。


OSX の場合は

/etc/apache2/other/

linuxの場合は

/etc/apache2/conf.d/

あたりが最初からincludeされています。


hoge.confとか作成して、こんな感じの設定を記述します。

Alias / "/path/to/"

<Directory "/path/to">
        AddHandler cgi-script .cgi
        DirectoryIndex index.cgi
        Options ExecCGI Includes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
</Directory>

AddHandlerやDirectoryIndexも指定してやるとアプリの開発や試験導入に便利です。


再起動後、DocumentRootがオーバーライドされます。

apachectl restart