How to Block a Website Using Squid
Squid-Cache, or simply Squid, is a tool network administrators can use to block local network access to particular websites. Blocking particular sites, or groups of sites, requires direct editing of the Squid configuration files.
Instructions
-
-
1
Install Squid by downloading the binary package for your operating system and following the system-specific directions in Squid's documentation (see Resources).
-
2
Open the Squid configuration file, squid.conf, usually located in /usr/etc/squid, and add the following two lines:
acl bad url_regex "/etc/squid/squid-block.acl"
http_access deny badThe filename in the quotes can actually be named and located whatever and wherever you want--you're going to create the file yourself in the next step.
-
-
3
Create the file referenced in Step 2. Anything you put in this file will be blocked by Squid. For example, adding lines like:
.com
xyzzy.org
sexwill block all sites with ".com" addresses; the specific site "xyzzy.org"; and all sites containing the word "sex." Save the file and close.
-
4
If this is your first time running Squid, create the program's swap directories by running the program from a terminal with the -Z option: "squid -z".
-
5
Run Squid with the simple "squid" command.
-
1
References
Resources
- Photo Credit network connection image by stresskiller from Fotolia.com