您的位置:首页 > 运维架构 > 反向代理

squid.3.3.4配置限制访问域名

2013-05-16 00:36 1701 查看
1:允许用户访问某些域名,我测试环境只写了一个;

[root@BJ-fastcache132 etc]# cat acl.txt
s0.hao123img.com





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


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


效果图:



官方文档介绍:
# # h1:m1 must be less than h2:m2
#
# acl aclname url_regex [-i] ^http:// ...
# # regex matching on whole URL [fast]
# 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 [fast]
#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  squid 3.x