ファイルをダウンロードして展開します。
# cd /usr/local/src
# wget http://www.muquit.com/muquit/software/Count/src/wwwcount2.5/wwwcount2.5.tar.gz
# tar xvzf wwwcount2.5.tar.gz
# cd wwwcount2.5
設定をします。
# make config.h
Continue [y|n]? y
*cgi-bin directory
[/usr/local/etc/httpd/cgi-bin]:
/home/USER/www/cgi-bin
どのcgi-binディレクトリにインストールするかを入力します。
*Base directory [/usr/local/etc/Counter]: /home/USER/Counter
どこにCounter関係の設定データファイルを保存するかを入力します。
このディレクトリはwebで見えないところでOKです。
* Config directory [/home/USER/Counter/conf]:
デフォルトのまま
* Name of the configuration file [count.cfg]:
デフォルトのまま
*Data directory [/home/USER/Counter/data]:
デフォルトのまま
*Digits directory [/home/USER/Counter/digits]:
デフォルトのまま
*Log directory [/home/USER/Counter/logs]:
デフォルトのまま
* Name of the log file [Count2_5.log]:
デフォルトのまま
Your configuration:
----------------------------------------------------------------
CgiBinDir=/home/USER/www/cgi-bin
BaseDir= /home/USER/Counter
DigitDir=/home/USER/Counter/digits
ConfDir= /home/USER/Counter/conf
ConfFile=count.cfg
DataDir=/home/USER/Counter/data
LogDir=/home/USER/Counter/logs
LogFile=Count2_5.log
----------------------------------------------------------------
Everything looks OK [y|n]? y
Great! creating header file src/config.h
creating variables template file ./Config.tmpl for the install program..
# make all
# make cfg
Continue [y|n]? y
* Enter your fully qualified domain name [no default]: www.kaji3.com
サーバー名を入力します。
* Enter your IP address [no default]: 192.168.0.144
サーバーのIPアドレスを入力します。
* Does your host have any nickname [y|n]:? y
バーチャルドメインでも使う場合にはy
* Enter your host's nickname (FQDN) [no default]: linux.kaji3.com
バーチャルドメイン名を入力します。
* Do you want to allow automatic file creation
[[y|n]?
n
新しいdataファイルを呼び出しがあった場合に自動で作るか?自動を選んだ場合、このようにどこからでもカウンタが使えてしまうので注意が必要です。
* Do you want the program to run in strict mode [[y|n]? n
* Do you want to ignore access hits from your own host [y|n]? y
サーバー自身でアクセスした場合にカウントするか?
* Allow using the rgb.txt file [y|n]? y
* Do you want to allow the counter to be reloaded [y|n]? y
更新ボタンを押した時にもカウントアップするか?
* Do you want to log error messages [[y|n]? y
* Do you want to show error messages to browsers [[y|n]? y
ここで設定した内容は後から変更可能です。
ファイルは/home/USER/Counter/conf/count.cfg。
特に自宅内ネットワークからのアクセスをカウントしないように動作確認が終わったら
[ignore IPs]
192.168.1.*
とするのがいいと思います。
# make install
中略
Press Control-C to abort
Continue [y|n]? y
中略
*Do you know the user and group id of httpd' child process [y|n]:? y
*Enter user id of httpd's child process [no default]:? apache
*Enter group id of httpd's child process [no default]:? apache
apacheを起動しているユーザーとグループを入力します。
RHLでインストールしている場合にはapache:apacheになります。
以上で設定完了です。
カウンタの動作確認はプラウザから直接呼び出して確認できます。
http://linux.kaji3.com/cgi-bin/Count.cgi?df=sample.dat&dd=cd°rees=270&ft=0
htmlから呼び出すときは以下のような感じでを表示させたいところに入れます。
<img
src="http://linux.kaji3.com/cgi-bin/Count.cgi?df=sample.dat&dd=cd°rees=270&ft=0">
<img src="cgi-bin/Count.cgi?df=sample.dat&dd=cd°rees=270&ft=0">
注意:cgiファイルを他のUSERのディレクトリに動かして動作させた場合に、Count.cgiはdataやConfigファイルの位置はコンパイル時に指示した値の場所を必要をします。他のディレクトリで実行させる場合にはdataやConfigの位置を変えてもう一度コンパイルしてインストールすることになります。その時にはConfig.tmplを削除してからもう一度make
config.hからやり直してください。
細かな表示のアレンジ方法をこちらをご覧下さい。
|