Basic Configuration
Edit your Squid configuration file:squid.conf
Configuration Steps
Locate Configuration File
Open
/etc/squid/squid.conf in your preferred text editor with root privileges:Add ACL Definition
Define the BlackWeb ACL by specifying the path to the blocklist file:This creates an Access Control List named
blackweb that matches destination domains from the file.Understanding the Configuration
ACL Syntax
- acl: Defines an Access Control List
- blackweb: The name of this ACL (can be customized)
- dstdomain: Matches destination domain names
- “/path_to/blackweb.txt”: Path to the domain list file
HTTP Access Rule
- http_access: Controls access to web resources
- deny: Blocks matching requests
- blackweb: References the ACL defined above
Rule Placement
Important: The order of rules in
squid.conf matters! Place your BlackWeb rules after any http_access allow rules for your clients, but before the final http_access deny all rule.Testing the Configuration
After applying the configuration, test that blocked domains are properly denied:Advanced Configuration
For more sophisticated filtering with allowlists, TLD blocking, and pattern matching, see the Advanced Rules guide.Troubleshooting
Squid won't start after adding BlackWeb
Squid won't start after adding BlackWeb
Check the following:
- Verify the file path is correct and the file exists
- Ensure the file has proper permissions (readable by the Squid user)
- Check syntax with:
squid -k parse - Review error logs:
tail /var/log/squid/cache.log
Domains aren't being blocked
Domains aren't being blocked
Verify:
- Rule placement (should be before
http_access deny all) - The domain exists in
blackweb.txt - Squid was restarted after configuration changes
- Client is actually using the proxy
Squid is slow after adding BlackWeb
Squid is slow after adding BlackWeb
BlackWeb contains over 4.7 million domains, which may impact performance on systems with limited resources. Consider:
- Increasing Squid’s memory allocation
- Using SSD storage for Squid cache
- Implementing advanced rules to reduce false positives
