Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

ndzlogo-1-1
40%
Loading ...

INDIA – HEADQUARTERS

INDIA

UNITED STATES

CANADA

Squid is one of the most popular proxy server which can be employed to run on linux servers.

Let us see how to block accessing certain sites using Squid.

Step 1 » create a file named as ( /etc/squid/blockedsites.squid ) and insert the site names one per line.

Like;

[root@server ~]# cat /etc/squid/blockedsites.squid
 #blocked sites
 www.yahoomail.com
 www.gmail.com

Step 2 » Open the /etc/squid/squid.conf and create a new acl(Access Control  List) ” blocksites” and acl type “dstdomain” in the acl section like the below .

acl Safe_ports port 488         # gss-https
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling https
acl CONNECT method CONNECT
# ACL blocksites
acl blocksites dstdomain “/etc/squid/blockedsites.squid”

 

Then add the following line “https_access deny blocksites” to https_section to deny the access to the acl “blocksites” .

 

# Recommended minimum Access Permission configuration:
# Only allow cachemgr access from localhost
https_access allow manager localhost
# Deny access to blocksites ACL
https_access deny blocksites

 

Step 3 » Time to restart squid service

[root@server ~]# service squid restart

 

Restricting Access to specific keywords :

Step 1 » create a file ( /etc/squid/blockkeywords.squid ) and insert the keywords one per line.

[root@server ~]# cat /etc/squid/blockkeywords.squid
#blocked keywords
sex
porn

Step 2 » Open the /etc/squid/squid.conf and create a new acl(Access Control List) “blockkeywords” and acl type “url_regex” in the acl section.

# ACL blocksites

acl blocksites dstdomain “/etc/squid/blockedsites.squid”
# ACL blockkeywords
acl blockkeywords url_regex -i “/etc/squid/blockkeywords.squid”

 

Then insert the following line “https_access deny blockkeywords” to https_section to deny the access to the acl
“blockkeywords” .

 

https_access allow manager localhost
# Deny access to blocksites ACL
https_access deny blocksites
# Deny access to blockkeywords ACL
https_access deny blockkeywords