Squid インストール
概要
フリーのプロキシサーバ「Squid」をインストールする。
環境は、WindowsXP。
プロキシ(Proxy)サーバ、ウェブキャッシュサーバ等に使用する。
環境は、WindowsXP。
プロキシ(Proxy)サーバ、ウェブキャッシュサーバ等に使用する。
参照
手順
DLページ から Squidを入手する。
この項を書いている時点での最新は、「squid-2.6.STABLE18-bin.zip」であったのでそれで進める。
この項を書いている時点での最新は、「squid-2.6.STABLE18-bin.zip」であったのでそれで進める。
not found (481.jpg)
解凍して、Cドライブ直下に配置。
squidはデフォルトで、Cドライブ直下での動作を想定している。
他の場所に配置するには、「squid.conf」内の記述を全て書き換える必要がある為、推奨しない。
squidはデフォルトで、Cドライブ直下での動作を想定している。
他の場所に配置するには、「squid.conf」内の記述を全て書き換える必要がある為、推奨しない。
not found (482.jpg)
not found (483.jpg)
「squid.conf」をエディタで編集する。
LAN内部のサブネットをACLで定義する。
サブネットアドレスは適宜変更のこと。
サブネットアドレスは適宜変更のこと。
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
アクセス許可に関する記述を追加する。
「allow」は「deny」より上で書くこと。順番を間違えると動作しない。
「allow」は「deny」より上で書くこと。順番を間違えると動作しない。
http_access allow manager localhost
#以下の行を追加。先程定義したACLを許可。
http_access allow lan
http_access deny manager
ログのローテーション回数を7(一週間分)にする。
# 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 7
プロキシサーバのドメイン名を定義。これをしないとエラー吐いて止まる。
# 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
プロキシ経由でアクセスしていることをアクセス先に知られないようにする設定を追加。
#以下の3行を追加。
header_access Cache-Control deny all
via off
forwarded_for off
「squid.conf」の変更は以上。
コマンドプロンプトを開き、「c:\squid\sbin」へ移動。

スワップ用ディレクトリの作成。
※「squid.conf」の設定に問題がある場合、この時点でエラーメッセージが表示される。
squid -z
サービスに追加。
squid -i
not found (484.jpg)
サービスを開始する。
not found (485.jpg)
ここまで「squid」のインストールは完了。
たんなるプロキシサーバとしてなら、このまま運用可能。
たんなるプロキシサーバとしてなら、このまま運用可能。
以下で動作確認ができる。
- プロキシをさして、診断くん にアクセスすると、プロキシの状態がわかる。
- プロキシのアクセスログは「c:\squid\var\logs\access.log」に残る。