Squid 2.4 Configuration Manual

Squid 2.4 Configuration Manual 

时间: 2008.12.24 15:26:00 
标签:  
Disclaimer: This manual is NOT a Squid tutorial. It is only a reference material that provides detailed explanation of all configuration parameters available in Squid 2.4. The reader is expected to have prior knowledge of basic Squid installation and configuration. For Complete tutorial on Squid, please visit http://www.squid-cache.org

 

Squid 2.4 Configuration Manual
<<Back
<< Contents >>
Next>>

TUNING THE SQUID CACHE

Tag Name wais_relay_host
wais_relay_port
Usage

wais_relay_host
wais_relay_port

Description
Relay WAIS request to host (1st arg) at port (2 arg).

Default wais_relay_port 0

Example
wais_relay_host localhost
wais_relay_port 8000

 

Tag Name request_header_max_size
Usage request_header_max_size (KB)

Description
This specifies the maximum size for HTTP headers in a request. Request headers are usually relatively small (about 512 bytes). Placing a limit on the request header size will catch certain bugs (for example with persistent connections) and possibly buffer-overflow or denial-of-service attacks.

Default request_header_max_size 10 KB

 

Tag Name request_body_max_size
Usage request_body_max_size (KB)

Description
This specifies the maximum size for an HTTP request body. In other words, the maximum size of a PUT/POST request. A user, who attempts to send a request with a body larger than this limit receives an "Invalid Request" error message. If you set this parameter to a zero, there will be no limit imposed.

Default request_body_max_size 1 MB

 

Tag Name reply_body_max_size
Usage reply_body_max_size (KB)

Description
This option specifies the maximum size of a reply body. It can be used to prevent users from downloading very large files, such as MP3's and movies. The reply size is checked twice. First when we get the reply headers, we check the content-length value. If the content length value exists and is larger than this parameter, the request is denied and the user receives an error message that says "the request or reply is too large." If there is no content-length, and the reply size exceeds this limit, the client's connection is just closed and they will receive a partial reply.

Default reply_body_max_size 0
If this parameter is set to zero (the default), there will be no limit imposed.

Caution
Downstream caches probably cannot detect a partial reply if there is no content-length header, so they will cache partial responses and give them out as hits. You should NOT use this option, if you have downstream caches.

 

Tag Name refresh_pattern
Usage refresh_pattern [-i] regex min percent max [options]

Description
'Min' is the time (in minutes) an object without an explicit expiry time should be considered fresh. The recommended value is 0; any higher values may cause dynamic applications to be erraneously cached unless the application designer has taken the appropriate actions.

'Percent' is a percentage of the objects age (time since last modification age) an object without explicit expiry time will be considered fresh.

'Max' is an upper limit on how long objects without an explicit expiry time will be considered fresh.

Options:

override-expire
override-lastmod
reload-into-ims
ignore-reload

override-expire enforces min age even if the server sent a Expires: header. Doing this VIOLATES the HTTP standard. Enabling this feature could make you liable for problems, which it causes.

override-lastmod enforces min age even on objects that was modified recently.

reload-into-ims changes client no-cache or ``reload'' to If-Modified-Since requests. Doing this VIOLATES the HTTP standard. Enabling this feature could make you liable for problems, which it causes.


ignore-reload ignores a client no-cache or ``reload'' header. Doing this VIOLATES the HTTP standard. Enabling this feature could make you liable for problems, which it causes.


Basically a cached object is: (the order is changed from 1.1.X)

FRESH if expires<now, else STALE
STALE if age >max
FRESH if lm-factor< percent, else STALE
FRESH if age < min
else STALE

The refresh_pattern lines are checked in the order listed here. The first entry which matches is used. If none of the entries match, then the default will be used.

Default

refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320

 

Tag Name reference_age
Usage reference_age time-units

Description
As a part of normal operation, Squid performs Least Recently Used removal of cached objects. The LRU age for removal is computed dynamically, based on the amount of disk space in use. The dynamic value can be seen in the Cache Manager 'info' output.

The 'reference_age' parameter defines the maximum LRU age

Default reference_age 1 year

Example
For example, setting reference_age to '1 week' will cause objects to be removed, if they have not been accessed for a week or more. The default value is one year.

Specify a number here, followed by units of time. For example:

1 week
3.5 days
4 months
2.2 hours

Caution
This parameter is not used when using the enhanced replacement policies, GDSH or LFUDA.

 

Tag Name quick_abort_min
quick_abort_max
quick_abort_pct
Usage

quick_abort_min (KB)
quick_abort_max (KB)
quick_abort_pct (percent)

Description
The cache can be configured to continue downloading aborted requests. This may be undesirable on slow (e.g. SLIP) links and/or very busy caches. Impatient users may tie up file descriptors and bandwidth by repeatedly requesting and immediately aborting downloads.

When the user aborts a request, Squid will check the quick_abort values to the amount of data transferred until then.

If the transfer has less than 'quick_abort_min' KB remaining, it will finish the retrieval. Setting 'quick_abort_min' to –1 will disable the quick_abort feature.

If the transfer has more than 'quick_abort_max' KB remaining, it will abort the retrieval.

If more than 'quick_abort_pct' of the transfer has completed, it will finish the retrieval.

Default

quick_abort_min 16 KB
quick_abort_max 16 KB
quick_abort_pct 95

Caution
This may be undesirable on slow (e.g. SLIP) links and/or very busy caches.

 

Tag Name negative_ttl
Usage negative_ttl time-units

Description
Time-to-Live (TTL) for failed requests. Certain types of failures (such as "connection refused" and "404 Not Found") are negatively-cached for a configurable amount of time. Note that, this is different from negative caching of DNS lookups.

Default

The default is 5 minutes.

negative_ttl 5 minutes

 

Tag Name positive_dns_ttl
Usage positive_dns_ttl time-units

Description
Time-to-Live (TTL) for positive caching of successful DNS lookups. If you want to minimize the use of Squid's ipcache, set this to 1, not 0.

Default

Default is 6 hours (360 minutes).

positive_dns_ttl 6 hours

 

Tag Name negative_dns_ttl
Usage negative_dns_ttl time-units

Description
Time-to-Live (TTL) for negative caching of failed DNS lookups

Default

negative_dns_ttl 5 minutes

 

Tag Name range_offset_limit
Usage range_offset_limit (bytes)

Description
Sets an upper limit on how far into the file a Range request may be to cause Squid to prefetch the whole file. If beyond this limit, then Squid forwards the Range request as it is and the result is NOT cached.

This is to stop a far ahead range request (lets say start at 17MB) from making Squid fetch the whole object up to that point before sending anything to the client.

A value of -1 causes Squid to always fetch the object from the beginning so that it may cache the result. (2.0 style).

A value of 0 causes Squid to never fetch more than the client requested. (default) .

Default range_offset_limit 0 KB

你可能感兴趣的:(cache,object,header,Parameters,reference,caching)