Enablng proxy and caching services

Proxy and caching services are turned off by default. You can turn them on by uncommenting several values, presented below:

# Proxy Server directives. Uncomment the following lines to

# enable the proxy server:

#<IfModule mod_proxy.c>

# ProxyRequests On

# Order deny,allow

# Deny from all

# Allow from .example.com

# Enable/disable the handling of HTTP/1.1 "Via:" headers.

# ("Full" adds server version; "Block" removes outgoing Via: headers)

#ProxyVia On

# To enable a cache of proxied content, uncomment the following lines.

# See http:/httpd.apache.org/docs-2.0/mod/mod_cache.html for more details.

#<IfModule mod_disk_cache.c>

# CacheEnable disk /

# CacheRoot "/var/cache/mod_proxy"

# CacheSize 500 #</IfModule>

# End of proxy directives.

Apache can function as a proxy server, a caching server, or a combination of the two. If Proxy Requests is set to off, the server will simply cache files without acting as a proxy. If CacheRoot (which specifies the directory used to contain the cache files) is undefined, no caching will be performed. Both proxy and caching services are off (commented out) by default.

Hyou turn on caching, the CacheRoot should exist on a file system with enough free space to accommodate the cache, which is limited by the CacheSize directive. However, you should have 20 to 40 percent more space available in the file system because cache cleanup (to maintain the CacheSize, in kilobytes) occurs only periodically (which you can set using the CacheGcInterval directive).

You can add other directives to this example to enable other caching features. The CacheMaxExpire directive can indicate the maximum number of hours that a document will exist in the cache without checking the original document for modifications. The CacheLastModifiedFactor applies to documents that do not have an expiration time, even though the protocol would support one. To formulate an expiration date, the factor (a floating-point number) is multiplied by the number of hours since the document' last modification. For example, if the document were modified three days ago and the CacheLastModifiedF actor were 0.25, the document would expire from the cache in 18 hours (as long as this value is still below the value of CacheMaxExpire).

The CacheDefaultExpire directive (specifying the number of hours before a document expires) applies to documents received via protocols that do not support expiration times. The NoCache directive contains a space-separated list of IP addresses, host names, or keywords in host names that should not have documents cached.

Here' how the caching server behaves if you uncomment the Cache lines above:

• The cached files would exist in /var/cache/mod_proxy.

• Cache size is limited to 500 Kbytes.

You may want to allow a much larger CacheSize, and possibly set a short CacheGcInterval, but otherwise the supplied values are reasonable. The CacheGcInterval value can be a floating-point number (for example, 1.25 indicates 75 minutes).

Was this article helpful?

0 0
Digital Photography Mastery

Digital Photography Mastery

Insider Secrets Revealed By the Pro Showing You How to Become a Professional Photographer! Discover The Secret Tips & Techniques On How To Be A Professional Photographer, Start Producing High Quality Pictures and Skyrocket Your Photography Business Income Revenue To The Roof TODAY! You're About to Discover the Powerful Strategies and Method to Start Taking Sharp, Clear and High Quality Pictures Like the Professional Photographer Without Paying a Single Penny to the Expert!

Get My Free Ebook

Post a comment