AWStatsJpnのMacOSX10.2.3へのインストールメモ tokada@s19.xrea.com 本家 http://awstats.sourceforge.net/ 日本語版 http://www.ryu.dyn.to/Tools/AWStatsJpn.html 【ダウンロード】 % curl -O http://www.ryu.dyn.to/AWStats-5.0-Release_Jpn.tar.gz % tar xvfz AWStats-5.0-Release_Jpn.tar.gz 【ログ形式の設定】 % sudo vi /etc/httpd/httpd.conf   # The location and format of the access logfile (Common Logfile Format).   # If you do not define any access logfiles within a   # container, they will be logged here. Contrariwise, if you *do*   # define per- access logfiles, transactions will be   # logged therein and *not* in this file.   #   #CustomLog /var/log/httpd/access_log common # << コメントアウト   #   # If you would like to have agent and referer logfiles, uncomment the   # following directives.   #   #CustomLog /var/log/httpd/referer_log referer   #CustomLog /var/log/httpd/agent_log agent   #   # If you prefer a single logfile with access, agent, and referer information   # (Combined Logfile Format) you can use the following directive.   #   CustomLog /var/log/httpd/access_log combined # << コメント外す 【/cgi-binのCGI実行許可設定】 % sudo vi /etc/httpd/httpd.conf AllowOverride None Options ExecCGI # << 追加 Order allow,deny Allow from all 【Apacheの再起動】 Apacheをシステム環境設定>共有で停止 % sudo mv /var/log/httpd/access_log /var/log/httpd/access_log.bk Apacheをシステム環境設定>共有で再起動 【配布ファイルをcgi-binディレクトリにコピー】 % cd AWStats-5.0-Release_Jpn/wwwroot/ % sudo cp -r cgi-bin/* /Library/WebServer/CGI-Executables/AWStats5/ % sudo cp -r icon/* /usr/share/httpd/icons/ % cd /Library/WebServer/CGI-Executables/AWStats5/ % mv awstats.model.conf_jp awstats.localhost.conf 【AWStatsの設定ファイル編集】 % sudo vi awstats.conf LogFile="/Library/WebServer/CGI-Executables/AWStats5/access_log.euc" DirIcons="/icons" SiteDomain="localhost" 【Jcode.pmのインストール】 参考 http://openlab.ring.gr.jp/Jcode/index-j.html % perl -MCPAN -e shell Cpan> install Jcode 【テスト用ログファイルの用意】 % /Library/WebServer/CGI-Executables/AWStats5/decode.pl < /var/log/httpd/access_log > /Library/WebServer/CGI-Executables/AWStats5/access_log.euc 【awstats.plファイルを実行し、更新処理を行う】 % ./awstats.pl -config=localhost -update 【awstats.plファイルを実行し、レポート作成処理を行う】 % perl awstats.pl -config=localhost -output -staticlinks > ../../Documents/awstats.test.html 【出力されたHTMLファイルをブラウザから閲覧してみる】 http://localhost/awstats.test.html にアクセスすればみえるはず。 テストhtmlは消しておきましょう。 % rm /Library/WebServer/Documents/awstats.test.html 【cronで走らせて自動更新する】 オリジナルを参考にしてMacOSX用に作りかえました。 うちのサイトに置いときます。 http://tokada.s19.xrea.com/files/misc/awstats_MacOSX.cron.gz cronが参照するディレクトリにこのスクリプトを入れる。 % chmod 555 awstats_MacOSX.cron % sudo cp awstats_MacOSX.cron /etc/periodic/daily/ ※/etc/periodic/以下を荒らしたくない方向け % sudo mkdir -p /usr/local/etc/periodic/daily/ % sudo cp awstats_MacOSX.cron /usr/local/etc/periodic/daily/ http://localhost/AWStats5.html に日々更新されるAWStats5の完成!