ちなみに、弊社では MacOS X 10.6 の「/etc/apache2/httpd.conf」を vi (sudo vi)で次のように書き換えてテスト環境としています。
※外部ネットワークから隔離された特定個人専用のテスト環境と割り切った設定ですので、絶対にこのままの設定で外部に公開したり、管理者以外のアカウントを作らないでください。
195-223行目(太字が変更箇所)
<Directory "/Library/WebServer/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options All
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
Documents を残して、新たに htdocs フォルダを作り、htdocs フォルダを公開フォルダとしています。
393-396行目(先頭の#を消す)
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi
407-408行目(先頭の#を消す)
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
そして次が絶対にやってはいけない設定です。CGI を(というよりApacheを)、そのMacを主に使っているアカウントの権限で動かしてしまいます。問題のある CGI 等を動かすと取り返しのつかないことになり得ます。絶対にこのまま外部に接続してはいけません。
決して真似してはいけません。
この方法は参考にせず、suExec などを導入しましょう。
125-130行目
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User あなたのアカウント
Group staff
さて、これで CGI を動かす準備が整いました。
CMONOS.JP を「/ライブラリ/WebServer」フォルダにインストールします。Perl のパスは「/usr/bin/perl」です。
Library
└WebServer
├cgi-data
├Documents ←使わない
└htdocs ←ここに htdocs フォルダの中身を設置
├cgi
┊
システム環境設定の「共有」で、「Web共有」を起動します。
既にチェックが入っている場合は、一度チェックを外してもう一度つけます。
コンピュータの名前を設定しておくと、「http://コンピュータの名前.local」で先ほどの「/Library/WebServer/htdocs」フォルダにアクセスできます。
弊社では MacPorts の方が ImageMagick をインストールしやすかったので、Perl は標準のものではなく MacPorts のものを使っています。標準の状態でも画像の縮小と SSL が必要な処理以外は動作します。
以上、めんどくさがりやさんのための、決してやってはいけないテスト環境構築方法でした。参考になりませんことをお祈りしております。