Q. How do I block any website accessing the Internet using squid proxy server?
A. You can simply use squid ACL to block access to any web site. There are 3 steps:
#1. Create a text file with blocked domain name list such as baddomain1.com, mail.yahoo.com, gmail.com and so on
#2. Define Acl
#3. Restart squid
First, create a file called /etc/squid/blocked.domains.acl
# vi /etc/squid/blocked.domains.acl
Append domain names,
gmail.com
baddomain.com
sex.com
mail.yahoo.com
Save and close the file. Open squid.conf file:
# vi /etc/squid/squid.conf
Create acl called blockeddomain:
acl blockeddomain dstdomain "/etc/squid/blocked.domains.acl"
Deny http access, enter:
http_access deny blockeddomain
Close and save the file. Restart squid proxy server:
# /etc/init.d/squid restart
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop














{ 7 comments… read them below or add one }
thanks for the tutorial it helped me a lot especially on blocking port and domain
Also the tutorial are ellaborative even to new comes to linux
Keep it up
Regard
Waloyce
Squid Block any Domain Name Accessing the Internet
does this resolution given works with LINUX SUSE 11.1?
I made the necessary changes but still does not work
Sputnik
explained well to understand at the first look, thank you.
explained effectively ….Thank you so much…..
this is not working at all for me ,I have rhel5server ,still clients able to access the sites .
Boomer this cannot do urls or wildcard just full domain names …