Blocking websites (and annoying ads) with Squid

A couple of websites that I visit have annoying auto-loading flash adverts. They annoy me so much that I decided I would figure out how to block them using my Squid proxy server. It’s actually quite straightforward.

First, edit /etc/squid/squid.conf and add the following line before the rules that allow access from your local network:

acl block_urls url_regex "/etc/squid/squid-block.acl"
http_access deny block_urls

Then create /etc/squid/squid-block.acl and put in domains that you want to block like so:

acvs.mediaonenetwork.net
.dailykos.com

In this example, anything on the dailykos.com domain would be blocked and while acvs.mediaonenetwork.net would also be blocked, anything else on that domain would be accessible.

This entry was posted in Tips, Web Serving. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">