April 25, 2009

How to block websites using Squid Server


Q. How do I deny a user accessing particular website? For example block orkut.com.

A. Squid cache is a popular open source web proxy server and web cache software.

It has a wide variety of uses, from speeding up a web server by caching repeated requests, to caching web, DNS and other network lookups for a group of people sharing network resources, to aiding security by filtering traffic.

Squid has powerful ACL (access control list). The primary use of the acl system is to implement simple access control.

How to deny a user from accessing particular site?

To block site called orkut.com , you need to add following two lines to your squid configuration file.

# vi /etc/squid/squid.conf

Search for `Access Controls' and append following two lines:


acl blocksites dstdomain .orkut.com
http_access deny blocksites

Save and close the file.

Restart Squid:


# service squid restart

Let us say you would like to deny access for anyone who browses to a URL with the word "teen" in it. Append following ACL:


acl blockregexurl url_regex -i teen
http_access deny blockregexurl

Save and close the file.

1 comment:

  1. hi,

    nice blog

    really it helped me.
    one more doubt like how to block https site other than port blocking. i want to facebook youtube https site. already i have blocked http site. some employees r going into https site. i wan to block plz provide wit some snapshots. so it will be clear for me. an will helpful for others in future

    ReplyDelete