「Squid インストール」の編集履歴(バックアップ)一覧に戻る

Squid インストール - (2008/03/19 (水) 09:40: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フォルダ中の以下のファイルをリネームする。
「cachemgr.conf.default」 ⇒ 「cachemgr.conf」
「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

acl lan src 192.168.0.0/255.255.255.0      # ← 追加。LANのサブネットを定義。
}

***アクセス許可
-「http_access」でさっきつくったACLを許可する。
-「allow」は「deny」より上で書くこと。順番を間違えると動作しない。

#highlight(perl){
http_access allow manager localhost
http_access allow lan             # ← 追加。先程定義したACLを許可。
http_access deny manager
}

***プロキシサーバのドメイン名を定義
-これをしないとエラー吐いて止まる。

#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	# ← 追加。
}

***プロキシサーバーを使用しているマシンのローカルIPアドレスを隠蔽化
#highlight(perl){
#  TAG: forwarded_for	on|off
#	If set, Squid will include your system's IP address or name
#	in the HTTP requests it forwards.  By default it looks like
#	this:
#
#		X-Forwarded-For: 192.1.2.3
#
#	If you disable this, it will appear as
#
#		X-Forwarded-For: unknown
#
#Default:
# forwarded_for on
forwarded_for off           # ← 追加。
}

***プロキシ経由でアクセスしていることをアクセス先に知られないようにする
#highlight(perl){
header_access X-Forwarded-For deny all
header_access Via deny all
header_access Cache-Control deny all
}

以上で「squid.conf」の変更は完了。

コマンドプロンプトを開き、「c:\squid\sbin」へ移動。

スワップ用ディレクトリの作成。

 squid -z

サービスに追加。

 squid -i

&img(484.jpg)

サービスを開始する。
ここまで「squid」のインストールは完了。
たんなるプロキシサーバとしてなら、このまま運用可能。

&img(485.jpg)
記事メニュー
目安箱バナー