How to Block Sites Using Squid

Written by kevin walker
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Block Sites Using Squid
(Hemera Technologies/ Images)

Squid is a free, open source HTTP proxy used by systems administrators and ISPs to minimise bandwidth by caching common Web pages on their own servers. If Squid is installed, then all Web traffic first passes through the software, making it a powerful tool for administrators to block unwanted websites from being accessed on their networks.

Skill level:
Moderately Easy


  1. 1

    Open the "squid.conf" file in your text editor of choice. On a Linux machine, this file should be located in "/etc/squid/squid.conf." On a Windows machine, it will be located instead in "C:\squid\etc\squid.conf."

  2. 2

    Paste the following code at the bottom of the squid.conf file and save it:

    acl blocksites url_regex "/etc/squid/squid-block.acl"

    http_access deny blocksites

    If you are on a Windows machine, you should replace the Linux style path (/etc/squid/squid-block.acl) with a Windows style path (C:\squid\etc\squid-block.acl). This tells Squid to block all the websites listed in the "squid-block.acl" file in the Squid directory.

  3. 3

    Open the "squid-block.acl" file in your text editor of choice. On a Linux machine, this should be located in "/etc/squid/squid-block.acl," while a Windows machine will have it in "C:\squid\etc\squid-block.acl." If the file does not exist, just save a new text file with that name.

  4. 4

    Paste the URLs of any websites you wish you block. You can also paste terms to search for in the names of the URLs. For example, to block pornographic websites, a good start may be:




    This will block any URLs which contain, anywhere within them, the words "sex," "porn" or "xxx."

Tips and warnings

  • Overzealous blocking of URLs by keyword can lead to sites being unintentionally blocked. For example, blocking the word "sex" will also block, among many other sites, the University of Sussex (, since it contains the word "sex" within its URL.

Don't Miss


  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.