Ban domain access in squid proxy server

Some times we need to control internet users in public hotspot or wifi or also school-college-university network . Anyone can control domains accessed by squid proxy by this tutorial .

First open squid proxy configuration :

nano /etc/squid3/squid.conf

Add below lines to that configuration anywhere and save it :

acl blockeddomain url_regex '/etc/squid3/blocked.domains.acl'
http_access deny blockeddomain
http_reply_access deny blockeddomain

Then open a new file by this command :

nano /etc/squid3/blocked.domains.acl

And add domains which you want to ban in every line each like below :

facebook.com
www.facebook.com

Now save that file and restart squid by :

service squid3 restart

Now users who will use this proxy of yours will not be able to access facebook or whatever you have entered in your /etc/squid3/blocked.domains.acl domain list .