calin radoni's humble web presence |
home![]() ![]() ![]() |
Squid: Blocking Unwanted Sites
There are many reasons to block access to some sites. I will not enumerate the reasons here. Here follows the
procedure that I have used for blocking access to some "annoying" advertising sites that turn my
webalizer
statistic to dust, beeing always in the Top 30 stats.
First you have to build a file where you must put the addresses you want to be blocked. Let's create one
in the default location for squid
configuration files,
/usr/local/squid/etc/
, and name it blockedAds
:
# touch /usr/local/squid/etc/blockedAdsand populate the file, using the editor of your choice, similar with this example:
.stupidAds.com .annoyingAds.com .intrusiveAds.orgIn this way you will block the whole domains specified there. Next we have to tell to the Squid Web Proxy Cache to use that file.
Edit the squid
's configuration file,
/usr/local/squid/etc/squid.conf
, and insert the following in the
http_access
section:
acl blockedAds url_regex "/usr/local/squid/etc/blockedAds" http_access deny blockedAdsNow you have to restart
squid
(stop and start).
For other squid
task and details you may want to check his web site and/or
read my document about
Squid Usefull Tasks
This document is copyrighted (c) 2005 by Calin Radoni. Permission is granted to copy and/or distribute this document.
No liability for the contents of this document can be accepted. Use the concepts, examples and information at your own risk. There may be errors and inaccuracies that could be damaging to your system. Proceed with caution, the author do not take any responsibility.
All copyrights are held by their respective owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark. Naming of particular products or brands should not be seen as endorsements.