Monday, 21 April 2014

Step by Step Install & Configure Squid Proxy Server on Linux.

Squid is a Proxy Server in Linux used for web filtering. Its widely used for increasing web server speed by caching repeated data.

1. Install Squid Server: 

Squid Server can be easily install using yum command line tool -

# Yum Install Squid

2. Setup Port and start Service:

Squid Server by default run on port 3128, If we want to change Squid Server port, Edit Squid configuration file and change http_port value:

#vi /etc/squid/squid.conf

Change http_port value

http_port 8080

Save and quite configuration file


Now Start/Restart Squid Service


#service squid restart

3. Configure Squid to Block Specific Websites:
If we have a long list of domain, Create a file /etc/squid/deniedsites.squid and put domain names one per line and add below rules in Squid configuration file:

#vi /etc/squid/squid.conf

acl badsites dstdomain ""/etc/squid/deniedsites.squid""
http_access deny badsites

Save and quite configuration file


deniedsites.squid file content example:

#cat /etc/squid/deniedsites.squid


www.rediffmail.com
www.yahoo.com
www.xxx.com

4. Configure Squid to Block Specific Keyword:
If we have a long list of specific keywords, Create a file /etc/squid/blockkeywords.lst and put keywords one per line and add below rules in Squid configuration file:

#vi /etc/squid/squid.conf

acl blockkeywordlist url_regex "/etc/squid/blockkeywords.lst"
http_access deny blockkeywordlist

Save and quite configuration file

blockkeywords.lst file content example:

#cat /etc/squid/blockkeywords.lst


rediffmail

yahoo
xxx
hotmail

For any query please feel free to contact me my email id is sashwatkatore@gmail.com.

No comments:

Post a Comment