Centos

How to Install and Configure Squid Proxy on CentOS 7

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.

sudo vi/etc/squid/squid.conf

Scroll down to find the following lines into the file.

# Squid normally listens to port 3128
http_port 3128


Now change the http_port from 3128 to any port you want. Make sure that no other service is using the port which you will use for Squid. Now restart the Squid daemon and you will see that the changes are in effect.

Conclusion

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.

Previous page 1 2 3

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close