Block a domain name in squid linux

FREQUENTLY ASKED QUESTIONS (Squid proxy)
Q: How to block a website (domain) in squid proxy server?


Squid can deny users accessing a specific website with a access denied error message. It can be done with squid "dstdomain" access lists (ACL).

Edit the squid.conf configuration file
[root@server ~]# vi /etc/squid/squid.conf

acl lan src 192.168.10.0/24                         # client ip range to block web sites
acl bad_sites dstdomain .foo.com .fooo.com            #Block two domains in single acl
http_reply_access deny bad_sites lan
#Add the above three lines and save the squid.conf file


Now squid server will deny browsing if anyone from the acl "lan" access the domain foo.com and fooo.com.
Note: Squid will also deny all sub domains of the blocked domain. for example if you block google.com, all Google's sub domains like news.google.com, maps.google.com,etc will also be blocked

Restart or reload squid with configuration changes
root@server ~]# service squid restart
or

3 comments:

Unknown said...

hi all,

i am changing in /etc/squid.conf file.


acl lan src 192.168.1.0/24
acl bad_sites dstdomain .facebook.com
http_reply_access deny bad_sites lan

but it dosn't work

Meow said...
This comment has been removed by the author.
Meow said...

@Patel
try this.

acl CONNECT method CONNECT
acl lan src 192.168.1.0/24
acl bad_sites dstdomain .facebook.com
http_access deny bad_sites lan
http_access deny CONNECT bad_sites lan

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons