Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How to block websites for particular IPs by squid?

Please give solution with example or configuration file.

share|improve this question

3 Answers 3

You need somthing like this:

acl BlockedHost src 192.168.1.15
http_access deny BlockedHost

The config file is well commented searching for the word acl will help you further.

Squid acl faq

share|improve this answer
up vote 4 down vote accepted

Example :

I blocked Facebook & orkut to all user but now i want to open only facebook to particular user or IP


Option 1 : Specify site with in configuration file,

acl special_clients src "/etc/squid/special_client_ips.txt"

acl facebook dstdomain .facebook.com

acl orkut dstdomain .orkut.com

Under http access

http_access allow facebook special_clients

http_access deny facebook

http_access deny orkut

http_access allow all


Option 2 : Stick both client IP s and destination domains into lists,

acl special_clients src "/etc/squid/special_client_ips.txt"

acl bad_domains dstdomain "/etc/squid/bad_domains.txt"

Under http access

http_access allow bad_domains special_clients

http_access deny bad_domains

http_access allow all

  • I get it from net, It work very well

  • Thanks cstamas

share|improve this answer

I create two files 1.special_client_ips and 2.open_websites. I insert some ips in file 1 and some blocked websites in file 2. But it will not open blockedv websites to that special_client_ips. My squid.conf is

acl special_clients src "/etc/squid/special_client_ips"

acl open_websites dstdomain "/etc/squid/open_websites"

Under http access

http_access allow open_websites special_clients

http_access deny open_websites

http_access allow all

Please help me ...

share|improve this answer

protected by Tom O'Connor Jul 8 at 10:08

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.