安旨ワイン探し安旨ワイン探し

安くて美味しい【安旨ワイン】を探し求めて飲んだワインをMEMO

Home » IT備忘録 » squid 2.7.6 win32版 設定メモ

squid 2.7.6 win32版 設定メモ

time 2009/06/18

●ZIPを解凍

●サーバーのc:\に[squid]フォルダを移動

●c:\squid\etc の
 squid.conf.default をCopyして squid.conf とする
 mime.conf.default をCopyして mime.conf とする

●squid.confの修正
[aaaaaa→ブラックリスト利用拠点やPC]
[bbbbbb→ホワイトリスト利用拠点やPC]
[cccccc→接続を拒否する利用拠点やPC]

600行目あたり aclリストの修正
#Recommended minimum configuration:
acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl aaaaaa src ???.???.???.???/?? # aaaaaa拠点のネットワークアドレスを入れる
acl bbbbbb src ???.???.???.???/?? ???.???.???.???/?? # bbbbbb拠点のネットワークアドレスを入れる
acl cccccc src 10.21.80.245
acl blacklist dstdomain “c:/squid/etc/blacklist.cfg”
acl blacklist_regex url_regex “c:/squid/etc/blacklist_regex.cfg”
acl whitelist dstdomain “c:/squid/etc/whitelist.cfg”
acl whitelist_regex url_regex “c:/squid/etc/whitelist_regex.cfg”
acl to_localhost dst 127.0.0.0/8
#
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
# acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
# acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
# acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
#
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
# acl Safe_ports port 70 # gopher
# acl Safe_ports port 210 # wais
# acl Safe_ports port 1025-65535 # unregistered ports
# acl Safe_ports port 280 # http-mgmt
# acl Safe_ports port 488 # gss-http
# acl Safe_ports port 591 # filemaker
# acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT

650行目あたり http_access の修正
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny blacklist
http_access deny blacklist_regex
http_access deny cccccc
http_access allow aaaaaa
http_access allow bbbbbb whitelist
http_access allow bbbbbb whitelist_regex
http_access deny manager

その10行下あたり
http_access allow localnet をコメントアウト

720行目あたり
#Allow ICP queries from local networks only
# icp_access allow localnet
icp_access allow aaaaaa
icp_access allow bbbbbb
icp_access deny all

1104行目あたり ポートの修正
http_port 3128→8080

2122行目あたり
access_log c:/squid/var/logs/access.log squid

access_log c:/squid/var/logs/access.log

2190行目あたり
# logfile_rotate 10

logfile_rotate 5

2216行目あたり
# emulate_httpd_log off

emulate_httpd_log on

3380行目あたり
#Default:
# none
以下を
visible_hostname px.exsample.com

4270行目あたり
#Default:
# error_directory c:/squid/share/errors/English
error_directory c:/squid/share/errors/Japanese

●エラーメッセージの変更
c:\squid\share\errors\Japanese\ERR_ACCESS_DENIED を差し替える

●キャッシュエリアの作成
squid.confの編集後実施する
C:\squid\sbin\squid -z

●Winサービスへ登録
C:\squid\sbin\squid -i(削除は-r)

●ログローテーション
以下の3命令のバッチファイルをタスクで毎日23:50に動かしてみる
C:\squid\sbin\squid -n Squid -k rotate
ping localhost -n 10 > nul
move C:\squid\var\logs\access.log.0 [ログ保存フォルダ]\access%date:~-10,4%%date:~-5,2%%date:~-2,2%.log
※Windows版は-nオプションでサービス名の指定が必要
※Cドライブの容量を考えて別ドライブのログ保存フォルダに「access年月日.log」というファイル名で移動する
ping命令を利用して待ち時間を入れないと、access.logがaccess.log.0にロテートされる前にmoveが動いちゃうので失敗する

down

コメントする




過去の記事