Syed Jahanzaib Personnel Blog to Share Knowledge !

January 23, 2012

SQUID: Howto Exclude some sites & Exntension from CACHING


Howto Exclude Few Sites from Caching

========================================

To exclude your local domain sites / range from cache, use following


acl local_server dst 192.168.0.0/24 192.168.1.0/24
cache deny local_server

========================================

If you are using SQUID proxy server and you don’t want to cache few sites , use the following directives,

SQUID 3.x

acl hotmail dstdomain .hotmail.com
always_direct allow hotmail

.

.

Another method

acl NO-CACHE-SITES dstdomain "/etc/squid/not-to-cache-sites.txt"
no_cache deny NO-CACHE-SITES
acl sharing_server dst 10.0.0.1
cache deny sharing_server

Now create the file which will contains our sites list which we don’t want to cache.

touch /etc/squid/not-to-cache-sites.txt

and add  your desired web sites name in /etc/squid/not-to-cache-sites.txt
For example

nano /etc/squid/not-to-cache-sites.txt


and add following or your entries

bankalhabib.com
aacable.wordpress.com
wordpress.com
nae.com.pk
jang.com.pk

Now we have to reload squid.conf so changes may apply by following command

squid -k rec
OR
squid -k reconfigure

OR if squid3 use

squid3 -k rec

.

.

.

Howto Exclude Specific Extension from Caching

Similarly if you don’t want to cache *.FLV files , use the following directives

hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \? \.flv
no_cache deny QUERY


Now we have to reload squid.conf so changes may apply by following command

squid -k rec
OR
squid -k reconfigure

.

.

.

.

Regard's
Syed Jahanzaib

The Silver is the New Black Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 2,361 other followers