After learning how to block website using ban list, so now in this short guide I am going to tell you how to restrict any websites based on keywords in squid proxy server.
Blocking keywords in squid proxy server is very helpful for the system administrators in colleges and schools networks.
Same as we make ban_domains list in my previous article, I will store all keywords in ban_keywords.txt file which you wish to block.
# vi /etc/squid/ban_keywords.txt
Add ACL to block website by reading ban_keywords.txt file.
Edit /etc/squid/squid.conf file:
# vi /etc/squid/squid.conf
acl bad_keywords url_regex “/etc/squid/ban_keywords.txt”
http_access deny bad_keywords
# systemctl restart squid.service
Try to search ban keywords in search engine, you will get squid default blocked message in browser.