1:允许用户访问某些域名,我测试环境只写了一个;
[backcolor=white !important][backcolor=rgb(224, 224, 224) !important][size=1em]1
[backcolor=white !important][size=1em]2
| [size=1em][backcolor=rgb(224, 224, 224) !important][size=1em][iyunv@BJ-fastcache132 etc]# cat acl.txt
[backcolor=white !important][size=1em]s0.hao123img.com
|
测试环境:修改本地host文件,指定上面2个域名对应一个IP; [backcolor=white !important][backcolor=rgb(224, 224, 224) !important][size=1em]1
[backcolor=white !important][size=1em]2
[backcolor=rgb(224, 224, 224) !important][size=1em]3
| [size=1em][backcolor=rgb(224, 224, 224) !important][size=1em]acl aclname dstdomain "/app/squid/etc/acl.txt"
[backcolor=white !important][size=1em]http_access allow aclname
[backcolor=rgb(224, 224, 224) !important][size=1em]http_access deny all
|
2:允许用户访问png格式图片配置: [backcolor=white !important][backcolor=rgb(224, 224, 224) !important][size=1em]1
[backcolor=white !important][size=1em]2
[backcolor=rgb(224, 224, 224) !important][size=1em]3
| [size=1em][backcolor=rgb(224, 224, 224) !important][size=1em]acl allow_sites urlpath_regex -i \.png$
[backcolor=white !important][size=1em] http_access allow allow_sites
[backcolor=rgb(224, 224, 224) !important][size=1em] 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] #
|