I am using squid server in my Debian server, I want to block some websites in my system and I followed all the procedures for this but there is no result.
4 Answers
You have to do some changes in squid.conf and here are the steps:
open this file /etc/squid3/squid.conf
add these lines:
acl bad_url dstdomain "/etc/squid3/bad-sites.acl" http_access deny bad_url
then go to /etc/squid3/bad-sites.acl and add domains with this format
.google.com .msn.com .app.facebook.com

- 6,880
- 16
- 81
- 127

- 404
- 1
- 6
- 10
-
6Adding the rules at the end of squid.conf file won't work. Add at appropriate position. Look for message like "INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS" – Mohammed H Apr 22 '15 at 10:20
-
Just a note: `.google.com` also blocks `google.com`. Don't try to add both, or squid gives an error. – tuomassalo Sep 02 '16 at 08:48
-
I've copy and past your config but it does not work did I miss something ? (please notice that I'm trying this prox for the first time right now ) ENV: Ubuntu 16.04 Squid3 – Saint - Cyr MAPOUKA Mar 27 '18 at 14:58
-
It took me a while to figure that I need to restart the proxy service to have the config rules applied in Windows. – Burhan May 05 '21 at 16:30
-
1I was able to block facebook.com from browser in phone, but when I use facebook app it was able to access facebook, why is that ? – letterphile Jan 02 '22 at 20:39
You can also do by following changes in squid.conf
acl toblock dstdomain .facebook.com .google.com
http_access deny toblock

- 101
- 1
- 3
Instead of Using all this Just go to the terminal press (window-button+T) then type
sudo gedit /etc/hosts
then select your ip address and write the name of the site you want to block
127.0.0.1 localhost blockme.example.com
this will route all requests to that domain to your IP address instead

- 37,464
- 17
- 118
- 167

- 9
- 1
search in squid.cong the line "acl CONNECT method CONNECT" after it insert the acl that you would like to block for exemple i would like to block facebook so :
acl FACEBOOK url_regex -i *.facebook.com*
the url_regex will help to block any url that contain facebook.com now search the line
"# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS" in squid config insert after it http_access deny <the_name_you_gave_to_your_act> in our exemple
http_access deny FACEBOOK

- 1
- 1
-
1As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 24 '22 at 01:41