Though Squid caches can enhance access by clients to a Web server, Squid can also reduce the load on a Web server. Web servers that become overwhelmed by requests can move their cachable pages to a Squid proxy server that can serve as a kind of alternate site, handling requests for those pages. In effect, the Web server becomes accelerated. Such a cache is known as a reverse proxy cache, focusing on the server instead of the client. A reverse proxy cache will intercept requests to a server, processing any for its cached pages. Only requests for noncached pages are forwarded to the original Web server.
To configure a reverse proxy cache, you use the http_port directive with the accel option (for Squid 2.4 and earlier you use httpd_accel directives). To specify a particular location for the accelerators, you use defaultsite (this replaces httpd_accel_host used in Squid 2.4 and earlier).
http_port 312 8
http_port 192.168.0.25:80 accel defaultsite=rabbit.mytrek.com
If your Squid proxy server and the Web server are operating on the same host, you need to specify the port that the Web server is using. This cannot be the same port as Squid is using. You use the cache_peer directive with the port option to specify the server port. You then specify the address of the Web server with the cache_peer directive and the originserver option. In the following example, the Web server is using port 80, whereas Squid is using port 3128:
http_port 312 8 # Port of Squid proxy cache_peer port 80
cache_peer originserver localhost # IP address of web server
With Squid 2.6, transparent caches are supported directly as an http_port option, transparent.
http_port 3218 transparent
To specify the use of host directives (virtual hosts), you use the vhost option. This replaces the httpd_accel_uses_host_header directive used in earlier versions. For virtual IP hosts you use vport.
In addition, DNS entries for the external network would use the IP address of the proxy server for the Web server host name, directing all the Web server requests to the proxy server. DNS entries for the internal network would use the Web server's IP address for the Web server host name, allowing the proxy to redirect noncached requests on to the Web server. If your network uses only one DNS server, you can set up a Split DNS server to specify internal and external addresses (see Chapter 36).
This page intentionally left blank
Was this article helpful?