【Squid FAQ】 最終更新日:2004年12月11日
【D-netプランページへ】【Squid Homeへ】 【FAQトップへ】
デフォルトでは、SquidはSSLリクエストの場合にはオリジナルサーバへ直接接続します。 しかし、もしあなたがSSLリクエストを親サーバを経由して接続したいなら、SSLリクエストを直接接続しないように最初に指定してください:
acl SSL method CONNECT
never_direct allow SSL
これと同時に、SSLリクエストを使う場合の親を1つだけ指定すべきです。 もし特別な親を指定するなら"cache_peer_access "で設定します。
cache_peer parent1 parent 3128 3130
cache_peer parent2 parent 3128 3130
cache_peer_access parent2 allow !SSL
こうすることで、SquidはSSLにparent2を使わずに、常にparent1を使うようになります。
これはLinuxの Async I/O を使う際の制限です。 Linuxのスレッドパッケージは内部でこっそりSquidのログローテーションで使うSIGUSR1シグナルを盗みます。
順序の良くないスレッドがLinuxで可能になっているなら、SquidのSIGUSR1は無効にされてしまいます。
squid.conf に cache_dir を追加するだけであとはsquid -z を実行するだけで簡単です。
squid.conf に cache_dir を追加するだけであとはsquid -z を実行するだけで簡単です。Squidは新しいキャッシュディスクを作成、古いものはそのまま残しておきます。
Henrik Nordstrom より:
あなたは非同期I/Oを有効にする為にconfigureオプションに--enable-async-io を指定したかも知れません。 スレッドを使うLinuxで最新のバージョンのlibc5か早い時期のバージョンのglibcを使うスレッドアプリケーションでは問題がある事を知っておいてください。 あなたのシステムがglibc 2.1.3もしくはそれ以降のものを使うことがない限り、私は Linux で--enable-async-ioを推薦しないでしょう。
あなたは、とても忙しいキャッシュを持っていることがない限り、--enable-async-ioが最良でないことを知っているべきです。低いロードであるキャッシュは、--enable-async-ioなしでもうまく働きます。
--enable-async-io を外してSquidを再コンパイルして下さい。 これによって正常に動作するならあなたのlibcはおそらくスレッドの操作に問題があります。(configureの際に"make
clean"を忘れないでください。)
Squid-2からは、その実装と設定は変更されました。認証は現在、外部のプロセス経由で処理されます。Arjan'sによるproxy auth pageページにはそれを始める方法が述べられています。シンプルな手順を以下に説明します。
すべての設定が終わったならSquidを起動してください。 もし何か抜けている事があればどうか私たち(squid-faq@squid-cache.org)に知らせてください。
これ以外の認証に関する資料はこちらをご覧ください。
プロキシー認証のためのACLが以下のように変わりました
(以前)
acl foo proxy_auth timeout
(現在)
acl foo proxy_auth username
どうかあなたのACLを適正に更新して下さい。- ユーザー名には適正な名前が必要です。タイムアウトの設定は、構成オプションで以下のようにします。:
auth_param basic credentialsttl timeout
David Luyer による:
この情報はバージョン2.2現在の情報です。 もしあなたがdelay poolsを使いたいのであれば、最新のSquid-2.2を使うことを強くお勧めします。
基準のどんなリストに基づく確かなリクエストのバンド幅を制限するために、遅れプールは方法を提供します。 このアイデアは学生による帯域コストを制限(スタッフトラフィックと静的なキャッシュとローカルのpeerヒットはハイスピードのままで)したかったWestern Australian university(西オーストラリア大学)から来ています。 これらは私がはるかに多くの複雑なパッチへを開発したマードック大学(オーストラリア西部大学の事)に中央ネットワークサービスにSquid 1.0のコードとしてありこれを"DELAY_HACK"と呼んでいました。 個人的な必要からそれを私は、クリーンで商標にかからない形式でこれに暗号化するように試みSquid-2の"delay pools"と呼びました。
私は多くの人のリクエストによってSquid-2.2においても利用できるようにしました。
Squid-2.2でdelay poolsを有効にするには、--enable-delay-pools をconfigureのオプションで指定してコンパイルしてください。
このFAQで使われる用語:
適切なクラスを与えるバケットグループとしてのまとまり。
プール内のバケットのまとまり。 例えば per-host bucket group(ピアホスト バケット グループ), per-network bucket group(ピアネットワーク バケットグループ)、または aggregate bucket group(総計 バケット グループ)。(aggregate bucket group(総計 バケット グループ) は実際には1つのバケットです)
個々の延期バケツは、所定の割合(与えられた限界まで)で再び満たされて、そして空っぽである場合にはトラフィックを遅らせさせられるトラフィック・アロケーションを表します。
クラスはどのくらいの遅延を行うかのdelay poolを決定する。 例えば、異なるクライアントIPが別々またはグループとして扱われる(または両方)かを決定します。
class 1 delay pool(クラス1延期プール)は、host subjectからプールへすべての依頼に利用されるひとつの統一されたバケットです。
class 2 delay pool は1つの統一のバケットと256のバケットで、各バケットは8ビットのネットワーク(IPv4 のクラスC)のホストを表します。
16ビットのサブネットのための256個のバケットで、各バケットはこれら16ビット(IPv4のクラスB)のネットワークを表します。
Delay pools はクライアントおよびクライアントグループへのトラフィック制限を様々な機能で許可します:
この許可オプションは、クラス1のdelay poolの番号の作成や、与えられたオブジェクト・タイプ(URL正規表現の使用による、あるいは類似した)へのある量の帯域幅および比較的小さなトラフィックを大きなトラフィックとの割合によって公正に帯域が使えるようにするような帯域幅の利用を許可します。
delay poolには幾つかの制限があります。
acl all src 0.0.0.0/0.0.0.0 # might already be defined
delay_pools 1
delay_class 1 1
delay_access 1 allow all
delay_parameters 1 64000/64000 # 512 kbits == 64 kbytes per second
これらのタグの説明のために、構成(configuration)ファイルを見てください。
1秒間のバッファ(max = restore = 64kbytes/sec)として制限を要求であり、瞬発的な感応(busrt is requested)ではありません。もし、 瞬発的な感応をして欲しい場合には、aggregate_max の値をより大きなものにしてください。そうすれば、トラフィックバーストを処理することができるでしょう。 単一のオブジェクトだけがダウンロードされている場合、バケットが空でないように、ダウンロード割合は要求された処理能力以下に下げられるでしょう。
単一のHTTPリクエストの接続速度を制限することができません。個々のホストをある帯域幅割合に制限することができます。特定のホストを制限するためには、そのホストのためのaclを定義して、上記の例を使用してくだい。その後、1グループのホストを制限するために、クラス2あるいは3のdelay poolを使用しなければなりません。例えば:
acl only128kusers src 192.168.1.0/255.255.192.0
acl all src 0.0.0.0/0.0.0.0
delay_pools 1
delay_class 1 3
delay_access 1 allow only128kusers
delay_access 1 deny all
delay_parameters 1 64000/64000 -1/-1 16000/64000
これらのタグの説明のために、構成(configuration)ファイルを見てください。
上記が作用させるためにキャッシュが合計512kbitsが与えられるます。そしてそれぞれのIPアドレスは、そのプールから128kbitsを得ます。
私たちはオプションを"proxy-only no-delay"とした6つのローカルのキャッシュpeerを使っており、これらはfast ethernetやマイクロウェーブ(ATM)でつながっています。
私たちのローカルなアクセスについては、dstdomain ACLを使用します。また、delay pool例外としてdelay poolの処理において"fast lookups"(DNS検査のための手段)の為に、dst ACLを使います。
我々のプロキシは、2つの仮想インターフェースを持っています。 1つは認証が必要な学生からの接続リクエストでトラフィックの課金をしていないもののためのdelay pool 。 また、主なUnixシステムのユーザーは、遅いまたは速いトラフィックを選ぶことができますが、速いキャッシュを使う場合にはトラフィックの課金が必要になります。彼らが必要とされないので、Ident探索は、遅いキャッシュを通してアクセスできません。 遅いアクセスの遅延には、クラス3のdelay poolを使い、部間やユーザ間の公平を取ります。 我々は、主なホストのlynxのユーザーが1つの遅れバケツで共にまとめられるようにしています。これらは、たいがいはテキスト・ページを見ていので帯域への深刻な問題とみなされていません。 それが我々だった場合には、ホストをクラス1遅れプールに運んで、そしてより大きいアロケーションを与えるかもしれません。
I prefer using a slow restore rate and a large maximum rate to give preference to people who are looking at web pages as their individual bucket fills while they are reading, and those downloading large objects are disadvantaged. This depends on which clients you believe are more important. Also, one individual 8 bit network (a residential college) have paid extra to get more bandwidth.
私の構成ファイルの該当部分 (IP addresses, etc, all changed):
# ACL definitions
# Local network definitions, domains a.net, b.net
acl LOCAL-NET dstdomain a.net b.net
# Local network; nets 64 - 127. Also nearby network class A, 10.
acl LOCAL-IP dst 192.168.64.0/255.255.192.0 10.0.0.0/255.0.0.0
# Virtual i/f used for slow access
acl virtual_slowcache myip 192.168.100.13/255.255.255.255
# All permitted slow access, nets 96 - 127
acl slownets src 192.168.96.0/255.255.224.0
# Special 'fast' slow access, net 123
acl fast_slow src 192.168.123.0/255.255.255.0
# User hosts
acl my_user_hosts src 192.168.100.2/255.255.255.254
# "All" ACL
acl all src 0.0.0.0/0.0.0.0
# Don't need ident lookups for billing on (free) slow cache
ident_lookup_access allow my_user_hosts !virtual_slowcache
ident_lookup_access deny all
# Security access checks
http_access [...]
# These people get in for slow cache access
http_access allow virtual_slowcache slownets
http_access deny virtual_slowcache
# Access checks for main cache
http_access [...]
# Delay definitions (read config file for clarification)
delay_pools 2
delay_initial_bucket_level 50
delay_class 1 3
delay_access 1 allow virtual_slowcache !LOCAL-NET !LOCAL-IP !fast_slow
delay_access 1 deny all
delay_parameters 1 8192/131072 1024/65536 256/32768
delay_class 2 2
delay_access 2 allow virtual_slowcache !LOCAL-NET !LOCAL-IP fast_slow
delay_access 2 deny all
delay_parameters 2 2048/65536 512/32768
同じコードも、異なる実験室あるいは学生とは異なる実行を与える際にそれらにより多くの柔軟性を与えるためにクラス2のdelay pool を使用して、部のうちのいくつかによって使用されます。
構成ファイル(configuration)にかなり具体的に記載されてます。
# DELAY POOL PARAMETERS (all require DELAY_POOLS compilation option) # ----------------------------------------------------------------------------- # TAG: delay_pools # This represents the number of delay pools to be used. For example, # if you have one class 2 delay pool and one class 3 delays pool, you # have a total of 2 delay pools. # # To enable this option, you must use --enable-delay-pools with the # configure script. #delay_pools 0 # TAG: delay_class # This defines the class of each delay pool. There must be exactly one # delay_class line for each delay pool. For example, to define two # delay pools, one of class 2 and one of class 3, the settings above # and here would be: # #delay_pools 2 # 2 delay pools #delay_class 1 2 # pool 1 is a class 2 pool #delay_class 2 3 # pool 2 is a class 3 pool # # The delay pool classes are: # # class 1 Everything is limited by a single aggregate # bucket. # # class 2 Everything is limited by a single aggregate # bucket as well as an "individual" bucket chosen # from bits 25 through 32 of the IP address. # # class 3 Everything is limited by a single aggregate # bucket as well as a "network" bucket chosen # from bits 17 through 24 of the IP address and a # "individual" bucket chosen from bits 17 through # 32 of the IP address. # # NOTE: If an IP address is a.b.c.d # -> bits 25 through 32 are "d" # -> bits 17 through 24 are "c" # -> bits 17 through 32 are "c * 256 + d" # TAG: delay_access # This is used to determine which delay pool a request falls into. # The first matched delay pool is always used, ie, if a request falls # into delay pool number one, no more delay are checked, otherwise the # rest are checked in order of their delay pool number until they have # all been checked. For example, if you want some_big_clients in delay # pool 1 and lotsa_little_clients in delay pool 2: # #delay_access 1 allow some_big_clients #delay_access 1 deny all #delay_access 2 allow lotsa_little_clients #delay_access 2 deny all # TAG: delay_parameters # This defines the parameters for a delay pool. Each delay pool has # a number of "buckets" associated with it, as explained in the # description of delay_class. For a class 1 delay pool, the syntax is: # #delay_parameters pool aggregate # # For a class 2 delay pool: # #delay_parameters pool aggregate individual # # For a class 3 delay pool: # #delay_parameters pool aggregate network individual # # The variables here are: # # pool a pool number - ie, a number between 1 and the # number specified in delay_pools as used in # delay_class lines. # # aggregate the "delay parameters" for the aggregate bucket # (class 1, 2, 3). # # individual the "delay parameters" for the individual # buckets (class 2, 3). # # network the "delay parameters" for the network buckets # (class 3). # # A pair of delay parameters is written restore/maximum, where restore is # the number of bytes (not bits - modem and network speeds are usually # quoted in bits) per second placed into the bucket, and maximum is the # maximum number of bytes which can be in the bucket at any time. # # For example, if delay pool number 1 is a class 2 delay pool as in the # above example, and is being used to strictly limit each host to 64kbps # (plus overheads), with no overall limit, the line is: # #delay_parameters 1 -1/-1 8000/8000 # # Note that the figure -1 is used to represent "unlimited". # # And, if delay pool number 2 is a class 3 delay pool as in the above # example, and you want to limit it to a total of 256kbps (strict limit) # with each 8-bit network permitted 64kbps (strict limit) and each # individual host permitted 4800bps with a bucket maximum size of 64kb # to permit a decent web page to be downloaded at a decent speed # (if the network is not being limited due to overuse) but slow down # large downloads more significantly: # #delay_parameters 2 32000/32000 8000/8000 600/8000 # # There must be one delay_parameters line for each delay pool. # TAG: delay_initial_bucket_level (percent, 0-100) # The initial bucket percentage is used to determine how much is put # in each bucket when squid starts, is reconfigured, or first notices # a host accessing it (in class 2 and class 3, individual hosts and # networks only have buckets associated with them once they have been # "seen" by squid). # #delay_initial_bucket_level 50
今のところ、1.1から2へのキャッシュコンテンツの変換はできません。 多くの人が求めればそのうち誰かがスクリプトを書くでしょう。
よろしかったら、あなたは、兄弟姉妹としてあなたの古いSquid-1.1キャッシュで新しいSquid-2キャッシュを構成することができます。数日または数週間の後で、古いSquidキャッシュを閉めて下さい。もし古いキャッシュからロードを強制することにオブジェクトをもつあなたの新しいキャッシュを望めば、あなたは、このようなことを試みることができます:
Squid-2 はあなたにエラーメッセージのカスタマイズを許しています。ソースファイルには、色々な言語のエラーメッセージが含まれています。 あなたはconfigureのオプションで言語を選択できます:
--enable-err-language=lang
その上、あなたは、エラー・メッセージ・テンプレート・ファイルを書きなおすことができます。このリストはSquidがメッセージに挿入できるタグについて述べています:
URL with FTP %2f hack
Squid error code
seconds elapsed since request received (not yet implemented)
errno
strerror()
FTP request line
FTP reply line
FTP server message
cache hostname
server host name
client IP address
server IP address
contents of err_html_text config option
Request Method
Error message returned by external auth helper
URL port \#
Protocol
Full HTTP Request
squid default signature
caching proxy software with version
local time
UTC
URL without password
URL with password (Squid-2.5 and later only)
cachemgr email address
dns server error message
%sがエラー・ページで使われることがない限り、Squidデフォルト・シグニチャーは自動的に加えられます。シグニチャーを変えるために、それぞれのエラー・ページに手動でシグニチャーを追加しなくてはいけません。
デフォルトのシグニチャーはこんな感じです:
<BR clear="all">
<HR noshade size="1px">
<ADDRESS>
Generated %T by %h (%s)
</ADDRESS>
</BODY></HTML>
はい、多くの命令は、名前が変更されました。それらのうちの幾つか:
これは今 cache_peer と呼ばれます。古い用語は、何を形成しているか説明していません。しかし、新しい名前は、あなたがキャッシュのための仲間を形成しているとあなたに伝えます。
cache_peer_domain に変更されました。
これらの指令によって提供される機能は、現在ではアクセスコントロールリストとしてインプリメントされます。always_direct と never_direct のオプションを使用を望むなら新しいsquid.confファイルはいくつかの例を持っています。
acl Uncachable url_regex cgi ?
no_cache deny Uncachable
このオプションはかつてはキャッシュディスク・サイズを指定しました。今は、 cache_dir にてディスク・サイズを指定します。
このオプションはcache_peer_accessに改名されました。また、書式は変わりました。今、このオプションはアクセスコントロールリストで行います。そして、allowを含まなければならないか、キーワードを否定しなければなりません。例えば:
acl that-AS dst_as 1241
cache_peer_access thatcache.thatdomain.net allow that-AS
cache_peer_access thatcache.thatdomain.net deny all
例は、Autonomous System Number が 1241の起源サーバーのためにはpeerキャッシュ thatcache.thatdomain.netにリクエストを送ります。
Squid-1.1では、構成オプションの多くが、それらに関連したユニットによって意味が違いました。例えば、
connect_timeout の値は数秒であったかもしれないが、read_timeout の値は 数分で与えなければなりませんでした。
スキッド-2で、これらの指令は数の後にユニットをとります。また、ユニットをやめれば、警告を得るでしょう。例えば、今以下の宛て先に書くべきです:
connect_timeout 120 seconds
read_timeout 15 minutes
【D-netプランページへ】【Squid Homeへ】 【FAQトップへ】
Copyright© 1998-2003 ROBATA.ORG