5d6d网 发表于 2018-12-27 08:08:53

squid.3.3.4配置限制访问域名

  1:允许用户访问某些域名,我测试环境只写了一个;
  

# cat acl.txt
s0.hao123img.com
http://blog.运维网.com/attachment/201305/010826380.png
http://blog.运维网.com/attachment/201305/010953140.png
  

  

  测试环境:修改本地host文件,指定上面2个域名对应一个IP;
acl aclname dstdomain"/app/squid/etc/acl.txt"
http_access allow aclname
http_access denyall  

  

  2:允许用户访问png格式图片配置: 
acl allow_sitesurlpath_regex -i \.png$
http_access allow allow_sites
http_access deny all  

  效果图:
http://blog.运维网.com/attachment/201305/003623671.png
  

  

  官方文档介绍:
  #         #h1:m1 must be less than h2:m2
  #
  #       acl aclname url_regex [-i] ^http:// ...
  #         # regex matching on whole URL
  #       acl aclname urllogin [-i] [^a-zA-Z0-9] ...
  #         # regex matching on URL login field
  #       acl aclname urlpath_regex [-i] \.gif$ ...
  #         # regex matching on URL path
  #
  




页: [1]
查看完整版本: squid.3.3.4配置限制访问域名