SQUID Proxy Server
SQUID is a Proxy server and also used for web filtering. Its widely used for increasing web server speed by caching repeated data. Proxy servers operate as an intermediary between a local network and Internet. Requests from local clients for web services can be handled by the proxy server. Squid is a high-performance HTTP and FTP caching proxy server. It is also known as a Web proxy cache. As it stores data from frequently used Web pages and files.
Usage : To Share internet, Block unwanted sites
Package : squid
Script : /etc/init.d/squid
Port : 3128
Configuration File : /etc/squid/squid.conf
Squid by default run on port 3128. If you want to start squid on different port, Edit squid configuration file (/etc/squid/squid.conf) and change http_port value. For example we are changing squid to run on port 8080
# vim /etc/squid/squid.conf
Start/Restart Squid service
# service squid restart
Configure SQUID to Block Specific Website
Add below rules to block specific website before any allow all rules. Below example will block www.yahoo.com and www.google.com
acl blocksite1 dstdomain www.yahoo.com
acl blocksite2 dstdomain www.google.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.
acl blocksitelist dstdomain " /etc/squid/blockwebsites.lst"
http_access deny blocksitelist
blockwebsites.lst file content example:
# cat /etc/squid/blockwebsites.lst
Configure Squid to Block Specific Keyword
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