Categories
BSD/Linux Computer Tech

squid ad blocking

To block ads using Squid is simple.

Get the list of ad urls:
## get new ad server list
curl -sS -L --compressed "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=0&mimetype=plaintext" > /etc/squid/ad_block.txt

Then add this to squid.conf to reference the file and block the urls:
## disable ads ( http://pgl.yoyo.org/adservers/ )
acl ads dstdom_regex "/etc/squid/ad_block.txt"
http_access deny ads
#deny_info TCP_RESET ads

Then, for Mac Ports at least, do this:
sudo port reload squid4

Or for a recent Linux it’d be something like:
sudo service squid4 restart

Leave a Reply

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