■AN HTTPDのインストール
AN HTTPDはGUIで設定できるWindows用のWeb Serverです。中田昭雄さんが開発し、提供しています。CGIやSSIも使え、バーチャルホストに対応しています。プロキシ、キャッシュサーバにもなります。Namazuは問題なく動作します。テキストベースの設定ファイルを編集する必要があるApacheに比べ、GUIで設定できるため、非常に分かりやすいのが特徴です。NT系ではサービスに対応しています。

入手先
http://www.st.rim.or.jp/~nakata/

ここから最新バージョンをダウンロードします。ZIP圧縮、自己解凍の両形式が置いてありますが、どちらでも構いません。中身は同じです。ここではZIP形式をダウンロードしたとして説明します。httpd***(***はバージョン番号).zipを適当なディレクトリで解凍(展開)すると、httpd***というディレクトリができ、その中にhttpd.exeなどのファイルとcgi-binなどいくつかのディレクトリが作成されます。このhttpd***ディレクトリをそのままCドライブ直下にコピーします。C:\httpd***となります。インストールはこれで完了です。インストール先はProgram Filesディレクトリなどでも構いませんが、Cドライブ直下が分かりやすいのではないでしょうか。

httpd.exeがAN HTTPD本体です。httpd.exeを実行すると、タスクトレイにAN HTTPDのアイコンが表示されます。

タスクトレイのAN HTTPDアイコンをクリックし、「オプション」の「一般」を選択します。右クリックで表示されるメニューからも選べます。



オプション/一般--設定名:"default"が基本設定をするためのパネルです。「一般」タブでドキュメントルートやPerlで記述したCGIを実行するための設定をします。



ここではhttp://yourhost.yourdomein/でアクセスした際にWeb Serverが表示するLocalなPCのパスを示すドキュメントルートを、新たにC:\httpd***に作成したnamazuディレクトリに変更。さらにcgi、pl拡張子のファイルをPerlで実行可能にするため、実行プログラムのパスC:\Perl\bin\perl.exeを記述しています。9x系の場合はヘルパープロセスを有効にしておくのが望ましいようです。

次にエイリアスを設定します。エイリアスはドキュメントルート以外にURLでアクセスした際に表示対象にしたいLocalなPCのディレクトリを関連づけます。例えばhttp://yourhost.yourdomein/search/でアクセスした際にC:\docsのファイルを表示したい場合は「一般パス」の「仮想パス」に/searchを、「ローカルパス」にC:\docsを記述し、追加します。



この画面ではWeb Server上の仮想パス/nmzbaseをLocalなPCのD:\namazu\nmzbaseに関連づけています。

設定が完了したら、動作確認します。ドキュメントルートで指定したディレクトリに適当なhtmlファイルをコピーし、正常にhtmlファイルが表示されるのを確認します。例えばC:\http***にあるreadme.htmlをドキュメントルートにコピーして表示させてみましょう。コピーしたら、ブラウザからhttp://localhost/readme.htmlかhttp://127.0.0.1/readme.htmlと入力してアクセスしてみます。127.0.0.1は「自分自身」にアクセスする特殊なIPアドレスです。

 ■namazu.cgiの設定
Web Serverの動作が確認できたらnamazu.cgiを設定します。

まず、C:\namazu\libexecにあるnamazu.cgi.exeをC:\httpd***\cgi-binにコピーします。
次にC:\namazu\etc\namazuにある設定ファイルnamazurcをC:\httpd***\cgi-binにコピーし、ドット付きの.namazurcにリネームします。ドット付きファイルはUNIXで環境設定ファイルに使われ、Namazu for WINも、これを引き継いでいます。

が、ここで問題が起きます。Windowsのエクスプローラからファイル名をドット付きにリネームしようとしても「ファイル名を入力してください」と怒られ、ドット付きファイルを作成できません。MS-DOSプロンプト(コマンドプロンプト)を使ってリネームしましょう。

C:\WINDOWS>cd C:\httpd***\cgi-bin

C:\httpd***\cgi-bin>move namazurc .namazurc

これで.namazurcを作成できます。エクスプローラでリネームできたことを確認します。

.namazurcをテキストエディタで開き、編集します。

# This is a Namazu configuration file for namazu or namazu.cgi.
#
# Originally, this file is named 'namazurc-sample'. so you should
# copy this to 'namazurc' to make the file effective.
#
# Each item is must be separated by one or more SPACE or TAB characters.
# You can use a double-quoted string for represanting a string which
# contains SPACE or TAB characters like "foo bar baz".


##
## Index: Specify the default directory.
##
Index C:\nmzindex  <--mknmzでインデックスを作成したディレクトリを指定します

##
## Template: Set the template directory containing
## NMZ.{head,foot,body,tips,result} files.
##
Template C:\nmzindex  <--Defaultのtemplateを使用する場合はindexと同じディレクトリを指定します。templateをカスタマイズした場合はカスタマイズしたtemplateを置いたディレクトリを指定します


##
## Replace: Replace TARGET with REPLACEMENT in URIs in search
## results.
##
## TARGET is specified by Ruby's perl-like regular expressions.
## You can caputure sub-strings in TARGET by surrounding them
## with `(' and `)'and use them later as backreferences by
## \1, \2, \3,... \9.
##
## To use meta characters literally such as `*', `+', `?', `|',
## `[', `]', `{', `}', `(', `)', escape them with `\'.
##
## e.g.,
##
## Replace /home/foo/public_html/ http://www.foobar.jp/~foo/
## Replace /home/(.*)/public_html/ http://www.foobar.jp/\1/
## Replace /C\|/foo/ http://www.foobar.jp/
##
## If you do not want to do the processing on command line use,
## run namazu with -U option.
##
## You can specify more than one Replace rules but the only
## first-matched rule are applied.
##
Replace /C\|/docs/ http://127.0.0.1/search/  <--検索対象の文書を置いてあるLacalなPCのディレクトリをWeb Serverの仮想パスに置き換えます。/C\|/docs/はCドライブのdocsディレクトリを意味しています。Web Serverのドキュメントルート以外のディレクトリを指定する場合はWeb Server側でエイリアスを設定しておく必要があります。ここではLocalなPCでテストするため、http://127.0.0.1/search/にリプレースしています

##
## Logging: Set OFF to turn off keyword logging to NMZ.slog.
## Default is ON.
##
Logging off  <--検索キーワードのログを取りたい場合はonにします。インデックスを作成したディレクトリのNMZ.slogに出力されます


##
## Lang: Set the locale code such as `ja_JP.eucJP', `ja_JP.SJIS',
## `de', etc. This directive works only if the environment
## variable LANG is not set because the directive is mainly
## intended for CGI use. On the shell, You can set
## environemtnt variable LANG instead of using the directive.
##
## If you set `de' to it, namazu.cgi use
## NMZ.(head|foot|body|tips|results).de for displaying results
## and use a proper message catalog for `de'.
##
Lang ja_JP.SJIS


##
## Scoring: Set the scoring method "tfidf" or "simple".
##
Scoring tfidf


##
## EmphasisTags: Set the pair of html elements which is used in
## keyword emphasizing for search results.
##
EmphasisTags "<strong class=\"keyword\">" "</strong>"

##
## MaxHit: Set the maximum number of documents which can be
## handled in query operation. If documents matching a
## query exceed the value, they will be ignored.
##
MaxHit 10000

##
## MaxMatch: Set the maximum number of words which can be
## handled in regex/prefix/inside/suffix query. If documents
## matching a query exceed the value, they will be ignored.
##
MaxMatch 1000

##
## ContentType: Set "Content-Type" header output. If you want to
## use non-HTML template files, set it suitably.
#ContentType "text/x-hdml"

TOPに戻る miyazawat@hotmail.com