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.

Leave a Reply