44.5. Editing Caching and Proxy Options

Squid has numerous settings that limit the size of cached objects, the size of client requests, and the types of pages to cache. They can be used to stop the server from storing enormous files (such as downloaded ISO images), to limit the size of files that clients can upload or download, and to prevent the cache of pages that change frequently (such as those generated by CGI scripts). The defaults will generally work fine, with the possible exception of the maximum upload size, which is only 1 MB.

To edit caching options, follow these steps:

1.
Click on the Cache Options icon on the main page to display the Cache Options form (from Figure 44.3) again.

2.
To set the maximum size of uploaded files, select the second option in the Maximum request body size field, enter a number into the text box, and select some units from the menu. 10 or 100 MB should be more than enough for anyone.

3.
To stop clients from downloading large files, fill in the Maximum reply body size field in the same way. This can be used to prevent the abuse of your network by clients down loading huge movies or ISO files, but can often be subverted by downloading a large file in pieces.

4.
If you want to set an upper limit on the time that a page can be stored in the cache, fill in the Maximum cache time field instead of leaving it set to Default. Otherwise, data will be cached for up to a year or until the expiration date set by the originating server.

5.
As well as caching downloaded files, Squid will remember error messages from servers and return them to clients that request the same page. You can change the amount of time that errors are cached by entering a number and selecting Units in the Failed request cache time field. If Default is chosen, errors will be cached for 5 minutes. Even this can be annoyingly long, however, if you have just fixed an error on a website.

6.
Squid will cache the responses to hostname lookups to reduce the amount of DNS activity, regardless of the TTLs that the DNS servers supply. If Default is selected in the DNS lookup cache time field, responses will be remembered for 6 hours. If this seems too long for you, select the second radio button and enter your own cache time instead.

7.
The Don't cache URLs for ACLs field can be used to completely prevent caching for certain URLs, web servers, or clients. Any request that matches one of the ACLs checked in this field will never be cached, and thus will always be fetched directly. You can use this feature to block the caching of dynamically generated pages by creating a URL Path Regexp ACL for .cgi or cgi-bin and selecting it here. See Section 44.6 “Introduction to Access Control Lists” for more details on how ACLs work and can be defined.

8.
Hit the Save button at the bottom of the page to return to the main menu. Because some additional caching options are on the memory and disk usage form, click on the Memory Usage icon to display it

9.
To limit the amount of memory that Squid will use, fill in the Memory usage limit field. Note that this limit only affects the maximum memory used for storing in-transit and frequently accessed files and negative responses. Because Squid uses memory for other purposes, it will certainly consume more than whatever you enter here. If Default is selected, a limit of 8 MB will be enforced, which is probably too low for a busy server.

10.
To prevent the caching of huge files, fill in the Maximum cached object size field. The default is only 4 MB, so if you have plenty of disk space it should definitely be increased.

11.
Hit the Save button at the bottom of the form and then the Apply Changes link on the main page to activate all of your new settings.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.8.216