「Squid インストール」の編集履歴(バックアップ)一覧に戻る
Squid インストール - (2008/03/19 (水) 15:05:44) のソース
// 現在のページ名 *&this_page() **概要 フリーのプロキシサーバ「Squid」をインストールする。 環境は、WindowsXP。 プロキシ(Proxy)サーバ、ウェブキャッシュサーバ等に使用する。 ***参照 -[[Squid NT/Windows2000/XP/2003>>http://squid.robata.org/squid_nt.html]] **手順 [[DLページ>>http://squid.acmeconsulting.it/download/dl-squid.html]] から Squidを入手する。 この項を書いている時点での最新は、「squid-2.6.STABLE18-bin.zip」であったのでそれで進める。 &img(481.jpg) 解凍して、Cドライブ直下に配置。 squidはデフォルトで、Cドライブ直下での動作を想定している。 他の場所に配置するには、「squid.conf」内の記述を全て書き換える必要がある為、推奨しない。 &img(482.jpg) etcフォルダ中の以下のファイルをリネームする。 「mime.conf.default」 ⇒ 「mime.conf」 「squid.conf.default」 ⇒ 「squid.conf」 &img(483.jpg) 「squid.conf」をエディタで編集する。 ***LAN内部のサブネットをACLで定義 -サブネットアドレスは適宜変更のこと。 #highlight(perl){ acl all src 0.0.0.0/0.0.0.0 acl manager proto cache_object acl localhost src 127.0.0.1/255.255.255.255 acl to_localhost dst 127.0.0.0/8 # 以下の行を追加。LANのサブネットを定義。 acl lan src 192.168.0.0/255.255.255.0 } ***アクセス許可 -「http_access」でさっきつくったACLを許可する。 -「allow」は「deny」より上で書くこと。順番を間違えると動作しない。 #highlight(perl){ http_access allow manager localhost #以下の行を追加。先程定義したACLを許可。 http_access allow lan http_access deny manager } ***ログのローテーション #highlight(perl){ # TAG: logfile_rotate # Specifies the number of logfile rotations to make when you # type 'squid -k rotate'. The default is 10, which will rotate # with extensions 0 through 9. Setting logfile_rotate to 0 will # disable the file name rotation, but the logfiles are still closed # and re-opened. This will enable you to rename the logfiles # yourself just before sending the rotate signal. # # Note, the 'squid -k rotate' command normally sends a USR1 # signal to the running squid process. In certain situations # (e.g. on Linux with Async I/O), USR1 is used for other # purposes, so -k rotate uses another signal. It is best to get # in the habit of using 'squid -k rotate' instead of 'kill -USR1 # <pid>'. # #Default: # logfile_rotate 10 ↓ コメントアウト logfile_rotate 10 } ***プロキシサーバのドメイン名を定義 -これをしないとエラー吐いて止まる。 #highlight(perl){ # TAG: visible_hostname # If you want to present a special hostname in error messages, etc, # define this. Otherwise, the return value of gethostname() # will be used. If you have multiple caches in a cluster and # get errors about IP-forwarding you must set them to have individual # names with this setting. # #Default: # none #以下の行を追加。 visible_hostname proxy.hogehoge.co.jp } ***プロキシ経由でアクセスしていることをアクセス先に知られないようにする #highlight(perl){ #以下の3行を追加。 header_access Cache-Control deny all via off forwarded_for off } 以上で「squid.conf」の変更は完了。 コマンドプロンプトを開き、「c:\squid\sbin」へ移動。 &img(489.jpg) スワップ用ディレクトリの作成。 ※「squid.conf」の設定に問題がある場合、この時点でエラーメッセージが表示される。 squid -z サービスに追加。 squid -i &img(484.jpg) サービスを開始する。 &img(485.jpg) ここまで「squid」のインストールは完了。 たんなるプロキシサーバとしてなら、このまま運用可能。 以下で動作確認ができる。 -プロキシをさして、[[診断くん>>http://taruo.net/e/?]] にアクセスすると、プロキシの状態がわかる。 -プロキシのアクセスログは「c:\squid\var\logs\access.log」に残る。