wwwcounter2.5のインストール
2000-05-23 作成 福島
2000-08-02 更新 福島
2000-09-09 更新 福島
TOP > tips > wwwcount
ここでは、バーチャルWebサーバ"www.example.com"をディレクトリ /www/ で管理した場合の例を示します。
www.example.com の IP アドレスは 192.168.10.20 とします。

デフォルトのインストールディレクトリは
 /usr/local/etc/httpd/cgi-bin/
 /usr/local/etc/Counter/
を使用しますが、ここでは
 /www/www.example.com/cgi-bin/
 /www/www.example.com/etc/Counter/
を使用します。

インストール後のディレクトリツリーはこうなります。
/www/
    +www.example.com/
                    |
                    +cgi-bin/
                    |       +Count.cgi               実行ファイル
                    |
                    +etc/
                        +Counter/
                                +digits/             表示用数字イメージディレクトリ
                                |
                                +conf/
                                |    +count.cfg      設定ファイル
                                |
                                +data/               データディレクトリ
                                |
                                +logs/
                                     +Count2_5.log   ログファイル

※アンインストールするときは、
  /www/www.example.com/cgi-bin/Cont.cgi
  /www/www.example.com/etc/Counter/
を削除すれば良い。

$ tar zxf wwwcount2_5_tar.gz アーカイブを解凍
$ cd wwwcount2.5/
$ make config.h                make するための config.h を生成する
(sh ./Count-config)
    Welcome to the configuration procedure of Count 2.5
    ---------------------------------------------------

    o You must know where your system keeps CGI programs (cgi-bin directory)
      It is necessary to generate the install program.
      This directory must exist. If this directory does not exist, the
      configuration procedure will Abort!

    o You have to decide a directory, where you will keep all counter related
      stuff. This directory will have other directories inside. Default
      values will be supplied, press Return key to accept the default value.
      
      Try to Accept the default value, it will make your life much easier, 
      because not much error checking is done to verify input.

    During installation, the directories will be created for you
    if they do not exist and if you have the permission to do so.
    ++
Continue [y|n]? y

    You need to enter the full path of the directory where you system
    keeps the CGI programs. 

*cgi-bin directory [/usr/local/etc/httpd/cgi-bin]: /www/www.example.com/cgi-bin

    You need to enter the base directory of the counter related stuff.
    It must be a absolute path.

*Base directory [/usr/local/etc/Counter]: /www/www.example.com/etc/Counter

    You need to enter the name directory of the configuration file.

* Config directory [/www/www.example.com/etc/Counter/conf]: 
違うディレクトリに設定ファイルを置きたい場合は入力する(今回はそのまま)

    You need to enter the name of the configuration file. Note, it
    is not the path of the file, just the name. No / is allowed in the
    name.
    This file contains the information about

        o if you want to ignore access from certain hosts
        o host access authentication

    You will create this file later by running the program "Gen_conf".

* Name of the configuration file [count.cfg]: 
設定ファイルを違うファイル名にしたいときは入力する(今回はそのまま)
              
    You need to enter the directory of the counter data file.
    
*Data directory [/www/www.example.com/etc/Counter/data]: 
カウントデータを違うディレクトリに置きたい場合は入力する(今回はそのまま)

    You need to enter the directory of digits

*Digits directory [/www/www.example.com/etc/Counter/digits]: 
数字イメージファイルを違うディレクトリに置きたい場合は入力する(今回はそのまま)

    You need to enter the directory of the Log file.

*Log directory [/www/www.example.com/etc/Counter/logs]: 
ログファイルを違うディレクトリに置きたい場合は入力する(今回はそのまま)

    You need to enter the name of the Log file. Note, it just a name, not
    the path. No / is allowed in the name.
    This file hold the error messages of the counter. It also
    logs if someone tried to access your counter remotely.

* Name of the log file [Count2_5.log]: 
ログファイルを違うファイル名にしたい場合は入力する(今回はそのまま)

Your configuration:
----------------------------------------------------------------
CgiBinDir=/www/www.example.com/cgi-bin
BaseDir= /www/www.example.com/etc/Counter
DigitDir=/www/www.example.com/etc/Counter/digits
ConfDir= /www/www.example.com/etc/Counter/conf
ConfFile=count.cfg
DataDir=/www/www.example.com/etc/Counter/data
LogDir=/www/www.example.com/etc/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
(sh ./Gen-conf)
    Welcome to the conf file generation procedure of Count 2.5

    This program creates a workable conf file for your host only, you have
    to edit it by hand if you want to add other hosts. The file will have
    enough comments in it to help you out. You also have to hand edit it
    if you want to use netmasks to mask out a entire network or a specific
    range of hosts in a network.

    First of all you must know your 
        1) fully qualified domain name (FQDN), for example,
            if your hostname is foo and your domain name is bar.com,
            then your FQDN is
            foo.bar.com

        2) IP address of your host, for example, 
            192.165.155.2 

        3) If your host has any nickname defined, for example,
            www.foo.com. Note, th nick name also has to be a FQDN.

Continue [y|n]? y
        
    No Error checking will be done with your hostname, therefore,
    you better make sure you are entering the fully qualified domain name.
          
* Enter your fully qualified domain name [no default]: www.example.com

    No Error checking will be done with your IP address, therefore,
    you better make sure you are entering the correct IP address.

* Enter your IP address [no default]: 192.168.10.20

* Does your host have any nickname [y|n]:? n 違うホスト名でも参照されたい場合は y を入力(今回は無し)
    
    Now you need to decide if you will allow the users to create datafiles
    for them automatically. If you allow, the counter datafile will be
    created for the user if it does not exist and a pre-determined counter
    number will be inserted to it. If you do not allow, you have to create
    the datafile for each user, provided that the data directory has proper
    write permission.  

    Allowing users to create datafile is very convenient, as you do not
    have to be asked all the time when someone decides to use the counter.
    But the dark side of this is, anyone will be able create datafiles in
    the data directory. The decision is yours.

* Do you want to allow automatic file creation [[y|n]? y

    Now you need to decide if you want to compile the program in strict   
    mode. If you compile the program in strict mode, the browsers which
    do not return the environment variable HTTP_REFERER, will not be
    served, that is no access hit will be recorded, no time or date
    will be displayed. Instead, a string 888888 will be displayed. 
    
    The strict mode ensures that your counter data file can not be messed
    by accessing the counter remotely from a browser which does not return
    that variable. Note, good browsers like netscape returns this
    variable. Other browsers e.g. Mosaic does not return this variable in
    IMG GET method at this time.  This strict mode is experimental at this
    time!

* Do you want the program to run in strict mode [[y|n]? y
* Do you want to ignore access hits from your own host [y|n]? y

    Ok, do you want the users to use the file rgb.txt for color name
    lookup? It is very inefficient to search this file every time the
    web page is loaded. If you answer yes, the color name
    will be looked up and used. If you answer no, the color will be
    looked up but instead of the counter image, the RGB value will
    be displayed and the user will be asked to use the RGB value
    instead. This will prevent users to use this file. However,
    the convenience of allowing to use rgb.txt file is that color name e.g,
    red, gold etc.  can be used instead of cryptic red, green and blue
    components of the color.
    
* Allow using the rgb.txt file [y|n]? y 色を名前 (blue 等) で指定することがなければ n を入力

    You can decide if you want to allow reload count in your site.
    When a visitor reloads a page and if you decided to count reload,
    the counter will increment with each reload. It is a good idea
    to ignore reload count as it minimizes remote abuse of the counter.
    Howerver, there may be situation when you will have to count reload,
    for example if visitors are coming through a proxy server. If you 
    decide to count reload, your users will have choice to ignore or
    count reload for their counters with "reload=T or F" options.

* Do you want to allow the counter to be reloaded [y|n]? y リロードされてもカウンタをUPしないなら n を入力

    You can decide if you want to log the counter error messages 
    or warning messages to the log file. If you are concerned about disk
    space, answer n to the question. 

* Do you want to log error messages [[y|n]? y
    You can decide if you want to show error messages to the browsers.
    The counter error messages are verbose and may reveal information about
    the system (e.g. full path of the data file or config file) in case of
    error. If you are concerned with privacy or simply don't care to show
    error messages to browsers (you are confident that the counter works
    perfectly), then answer n to the question. If you answer n, then then
    if there is an error or the access is denied, the visitor will see the
    broken image (browser default).

* Do you want to show error messages to browsers [[y|n]? n

    Created conf file "count.cfg"
    Please look at it, you might want to edit it!

$ vi count.cfg 設定ファイルを編集(必要なら)
$ cat count.cfg こんな感じです
###-----------------------------------------------------------------------
### configuration file for Count 2.5
### Automatically generated from user input by the script Gen-conf
### created on: Mon May 15 14:39:45 JST 2000
### Note: Configuration file format for Count 2.5 is different than
###       older versions. -- mm
### The format of the file is described below:
###   - Any line starts with # or ; is considered comment and ignored.
###   - A section in the file is inside left and right bracket.
###   - Each section has parameters below the section.
###
### Please read the Configuration section in the counter webpage for details.
### The official counter homepage is at URL:
###     http://www.fccc.edu/users/muquit/Count.html
###----------------------------------------------------------------------

[version]
   2.5 

##-- options section
; If auto_file_creation=Yes, then the users can create data files. It IS
;  dangerous to set this option to Yes.
#
; strict_mode=Yes or No. Run the program in strict mode or not. It's a good
;  idea to set this option to Yes.
#
; allow_rgb_database=Yes or No. Convenient to use because colorname e.g., red,
;  gold etc can be used instead of rgb components of the color, however it is
;  very inefficient to lookup. If your site is busy, set this option to No.
#
; count_reload=Yes or No. It is a good idea to set this option to No. But
;  you've to set this option to Yes if you are running a proxy server.
;  Normally set this option to Yes.
#
; log_error_messages=Yes or No. If your site is extremely busy and if the
;  counter generates lots of logs, set this option to No. Normally set this
;  option to Yes.
#
; show_error_messages_to_browsers=Yes or No. Set this option to No if you're
;  concerned with privacy and you're sure that the counter works perfectly.
;  If you set this option to No, you will not see error messages.

[options]
  auto_file_creation=Yes
  strict_mode=Yes
  allow_rgb_database=Yes
  count_reload=Yes
  log_error_messages=Yes
  show_error_messages_to_browsers=No


; You can specify IP address of the hosts you want to ignore from counting.
; netmasks can be used to ignore a entire network or a specificrange of
; hosts in the network. Read the counter documentation to know about
; netmasks. Wild card can be used as well. one item per line.
;
[ignore IPs]
  192.168.10.20

;
; All possible names and IP addresses by which your host can be referred.
; These hosts can access the counter remotely or locally. Host running
; the http server must exist here. Wild card can be used. one item per line.
;
[authorized]
  www.example.com
  www
  192.168.10.20
;  test.counter.com 要らないのでコメントアウト
$ su インストールするため root になる # make install (sh ./Count-install) *** You are installing Counter as root *** ------------------------------------------------------------------------- Your configuration is shown below. You are only allowed to change the cgi-bin directory. If you want to change it, edit the file Config.tmpl and change the variable CGIBIN_DIR to the appropriate directory. Do not change anything else. cgi-bin directory = /www/www.example.com/cgi-bin conf directory = /www/www.example.com/etc/Counter/conf conf file to install= count.cfg digit directory = /www/www.example.com/etc/Counter/digits data directory = /www/www.example.com/etc/Counter/data log directory = /www/www.example.com/etc/Counter/logs log file = Count2_5.log RGB file to install = ./data/rgb.txt ------------------------------------------------------------------------- Press Control-C to abort Continue [y|n]? y proceeding... Now if you know what user and group id child processes of http server use, I can change the ownership and access permission accordigly. If you do not know, they are usually defined in the file httpd.conf with User and Group. I suggest create a unique user and group say httpd and set the User and Group to httpd. *Do you know the user and group id of httpd' child process [y|n]:? n installing Count.cgi->/www/www.example.com/cgi-bin installing count.cfg->/www/www.example.com/etc/Counter/conf installing sample datafile ./data/data/sample.dat->/www/www.example.com/etc/Counter/data installing rgb.txt->/www/www.example.com/etc/Counter creating Log directory /www/www.example.com/etc/Counter/logs installing image strip for digit style A->/www/www.example.com/etc/Counter/digits/A installing sample image peng.gif->/www/www.example.com/etc/Counter/digits/A installing image strip for digit style B->/www/www.example.com/etc/Counter/digits/B installing strip image for digit style C->/www/www.example.com/etc/Counter/digits/C installing strip image for digit style D->/www/www.example.com/etc/Counter/digits/D installing sample image lenna.gif->/www/www.example.com/etc/Counter/digits/D installing strip image for digit style E->/www/www.example.com/etc/Counter/digits/E installing image foo.gif in E->/www/www.example.com/etc/Counter/digits/E installing image yeehaw.gif in A->/www/www.example.com/etc/Counter/digits/A installing strip image for digit style cd->/www/www.example.com/etc/Counter/digits/cd installing strip image for digit style cdr->/www/www.example.com/etc/Counter/digits/cdr installing strip image for digit style cdd->/www/www.example.com/etc/Counter/digits/cdd installing strip image for digit style bang->/www/www.example.com/etc/Counter/digits/bang installing the mirroring script