Blacklist
Run following command to create /etc/ad_block.txt
file
curl -sS -L --compressed "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=0&mimetype=plaintext" > /etc/ad_block.txt
Configure
Add config to squid.conf
## disable ads ( http://pgl.yoyo.org/adservers/ )
acl ads dstdom_regex "/etc/ad_block.txt"
http_access deny ads
Automating the Fetching of the Blacklist
Create script /etc/newads.sh
#!/bin/bash
curl -sS -L --compressed "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=0&mimetype=plaintext" > /etc/squid3/ad_block.txt
## restart squid
/usr/sbin/squid3 restart
Modify crontab -e
to run script weekly
# Squid3 fetch ad blocker blacklist
5 4 * * 1 /etc/newads.sh > /dev/null 2>&1
Thank https://badzilla.co.uk/ad-blocker-using-squid-proxy-raspberry-pi