How to Install SQUID Proxy Server on Cent OS

Squid is the most popular Proxy server for Linux systems. It also used for the web filtering. Its widely used for increasing web server speed by caching repeated data.

This article will help you to Install and Configure SQUID Proxy Server on CentOS, Redhat and Fedora Linux systems.

Squid packages are available in default yum repositories. Execute below command on your server to install SQUID proxy server.

# yum install squid

Squid default runs on port 3128. If you want to start squid on different port, Edit squid configuration file and change http_port value. For example we are changing squid to run on port 8080.
/etc/squid/squid.conf

After making changing let’s restart Squid service to reload the configuration changes

# systemctl restart squid

Let’s start with the additional configuration like blocking any website using squid proxy server. Add below rules to block specific website before any allow all rules. Below example will block google.com and facebook.com.

acl blocksite1 dstdomain google
acl blocksite2 dstdomain facebook.com
http_access deny blocksite1
http_access deny blocksite2

If you have a long list of domain names, Create a file /etc/squid/blockwebsites.lst and put domain names one per line and add below rule in squid configuration file.

blockwebsites.lst file content example:

# cat /etc/squid/blockwebsites.lst
google.com
facebook.com

Add below rules to block specific website before any allow all rules. Below example will block all pages having keyword yahoo or Gmail.

acl blockkeyword1 url_regex yahoo
acl blockkeyword2 url_regex gmail
http_access deny blockkeyword1
http_access deny blockkeyword2

If you have a long list of keywords, Create a file /etc/squid/blockkeywords.lst and put keywords one per line and add below rule in squid configuration file.

acl blockkeywordlist url_regex “/etc/squid/blockkeywords.lst”
http_access deny blockkeywordlist

blockkeywords.lst file content example:

cat /etc/squid/blockkeywords.lst

yahoo
gmail
facebook

Congrats !!! you have successfully installed Squid proxy Server 🙂

About

View all posts by

Leave a Reply

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