calin radoni's humble web presence

homedocstoolboxabout

Squid: Blocking Unwanted Sites

Table of Contents

Introduction

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.

The blocking sites file

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/blockedAds
						
and populate the file, using the editor of your choice, similar with this example:
.stupidAds.com
.annoyingAds.com
.intrusiveAds.org
						
In 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.

Configure Squid to use the blocking sites 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 blockedAds
						
Now you have to restart squid (stop and start).

Other details

For other squid task and details you may want to check his web site and/or read my document about Squid Usefull Tasks

History

Copyright and License

This document is copyrighted (c) 2005 by Calin Radoni. Permission is granted to copy and/or distribute this document.

Disclaimer

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.


Copyright © 2005 - 2009 Calin Radoni Hosted on http://www.oocities.org/calinradoni Last page modification is 14 July 2005