Squid is one of the most popular proxy server which can be employed to run on linux servers.
Let us see how to block accessing certain sites using Squid.
Step 1 » create a file named as ( /etc/squid/blockedsites.squid ) and insert the site names one per line.
Like;
[root@server ~]# cat /etc/squid/blockedsites.squid
#blocked sites
www.yahoomail.com
www.gmail.com
Step 2 » Open the /etc/squid/squid.conf and create a new acl(Access Control List) ” blocksites” and acl type “dstdomain” in the acl section like the below .
Step 3 » Time to restart squid service
[root@server ~]# service squid restart
Restricting Access to specific keywords :
Step 1 » create a file ( /etc/squid/blockkeywords.squid ) and insert the keywords one per line.
[root@server ~]# cat /etc/squid/blockkeywords.squid
#blocked keywords
sex
porn
Step 2 » Open the /etc/squid/squid.conf and create a new acl(Access Control List) “blockkeywords” and acl type “url_regex” in the acl section.
# ACL blocksites