Squid Block any Domain Name Accessing the Internet

by on January 31, 2008 · 7 comments· LAST UPDATED February 6, 2008

in , ,

Q. How do I block any website accessing the Internet using squid proxy server?

A. You can simply use squid ACL to block access to any web site. There are 3 steps:

#1. Create a text file with blocked domain name list such as baddomain1.com, mail.yahoo.com, gmail.com and so on

#2. Define Acl

#3. Restart squid

First, create a file called /etc/squid/blocked.domains.acl
# vi /etc/squid/blocked.domains.acl
Append domain names,

Save and close the file. Open squid.conf file:
# vi /etc/squid/squid.conf
Create acl called blockeddomain:
acl blockeddomain dstdomain "/etc/squid/blocked.domains.acl"
Deny http access, enter:
http_access deny blockeddomain
Close and save the file. Restart squid proxy server:
# /etc/init.d/squid restart

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 7 comments… read them below or add one }

1 Waloyce October 18, 2008 at 12:38 pm

thanks for the tutorial it helped me a lot especially on blocking port and domain

Also the tutorial are ellaborative even to new comes to linux

Keep it up



2 vinay April 9, 2012 at 1:09 pm

Squid Block any Domain Name Accessing the Internet


3 Sputnik August 25, 2009 at 3:54 am

does this resolution given works with LINUX SUSE 11.1?
I made the necessary changes but still does not work



4 Vivek September 20, 2009 at 12:48 pm

explained well to understand at the first look, thank you.


5 Vivek October 15, 2009 at 4:49 am

explained effectively ….Thank you so much…..


6 manan February 27, 2010 at 7:33 pm

this is not working at all for me ,I have rhel5server ,still clients able to access the sites .


7 vooo March 14, 2010 at 8:16 am

Boomer this cannot do urls or wildcard just full domain names …


Leave a Comment

Tagged as: , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: