Block Sites based on Specific Keywords
Just like how you block a website based on a domain, you can also restrict access to a website by the use of a keyword. Create a file with specific keywords.
sudo vi /etc/squid/restricted_keyword
Now enter the list of keywords you want to block. One keyword per line.
porn ads movie gamble
Make the necessary changes on squid configuration file.
sudo vi /etc/squid/squid.conf
Just after the ports ACLs add the following two lines:
acl keyword-ban url_regex "/etc/squid/restricted_keyword" http_access deny keyword-ban
Now save the file and restart squid:
sudo systemctl restart squid
Changing Squid Port
You can easily change the port on which squid listens to. Edit the configuration file using the following command.
Scroll down to find the following lines into the file.
# Squid normally listens to port 3128 http_port 3128
In this detailed tutorial we learned how to install Squid proxy server on CentOS 7 systems. You can now easily setup a basic installation of Squid. You also learnt about some basic configuration of Squid proxy server inclusding enabling basic authentication.
If you have any questions or comments, please post them in the comment section below.