Squid is a popular Proxy server for Unix like operating systems. It also used for the web filtering. Its widely used for increasing web server speed by caching repeated data. This tutorial helps you to install Squid proxy server on your Debian 8 Jessie system. Also provide basic configuration details of Proxy server to allow traffic, restrict specific websites with keyword or domain names. Step 1 – Install Squid on Debian 8Login to your Debian 8 system using root or sudo privileges user. Then run the following commands on the console to install Squid on Debian 8 system from the default package repository.
Sudo apt updatesudo apt install squidStep 2 – Configure Squid PortSquid default runs on port 3128. It is your choice to keep running squid on default port or change it to some different port.
Squid has extensive access controls and makes a great server accelerator. It runs on most available operating systems, including Windows and is licensed under the GNU GPL. Squid it’s available on Debian, so we can install Version 3 with the command.
To change port edit squid configuration file and change httpport value./etc/squid/squid.conf httpport 3128After making changing let’s restart Squid service to reload the configuration changes sudo service squid restartStep 3 – Allow All TrafficAssuming you need a proxy server open to all, Then you need to allow all traffic on your proxy server. Edit the Squid configuration file and Comment the httpaccess deny all line. Then add the httpaccess allow all entry this file.
Httpaccess allow all#httpaccess deny allStep 4 – Block Specific Website with SquidHere you want to block some specific websites through the proxy server. Then add the following rules to block specific website just before the allow all rule. Below example will block yahoo.com and www.rediff.com. Acl blocksite1 dstdomain yahoo.comacl blocksite2 dstdomain www.rediff.comhttpaccess deny blocksite1httpaccess deny blocksite2If you have a large number of domain names, then create a file /etc/squid/blockwebsites.lst and put domain names one per line and add below rule in the squid configuration file. Acl blocksitelist dstdomain '/etc/squid/blockwebsites.lst'httpaccess deny blocksitelistblockwebsites.lst file content example: cat /etc/squid/blockwebsites.lstyahoo.comwww.rediff.comStep 5 – Block Specific Keyword with SquidYou can also block websites for specific keywords.
Add the following rules just before the allow all rule. Below is the example of blocking all pages having keyword yahoo or Gmail. Acl blockkeyword1 urlregex yahooacl blockkeyword2 urlregex gmailhttpaccess deny blockkeyword1httpaccess deny blockkeyword2If you have a large number of keywords to block then create a file /etc/squid/blockkeywords.lst and put keywords one per line and add below rule in the squid configuration file. Acl blockkeywordlist urlregex '/etc/squid/blockkeywords.lst'httpaccess deny blockkeywordlistblockkeywords.lst file content example: cat /etc/squid/blockkeywords.lstyahoogmailfacebookCongratulation’s you have successfully install and configured Squid proxy server. Read next article to.