HPUX做代理服务器(4) 或者为了保证高级用户的带宽,希望每个用户的并发连接不能太多,以免影响他人,也可以通过Squid控制,代码如下: acl conncount maxconn 3 http_access deny conncount normal http_access allow normal 这样,普通用户在某个固定时刻只能同时发起三个连接,从第四个开始,连接将被拒绝。 总之,Squid的ACL配置非常灵活、强大,更多的控制方式可以参考squid.conf.default。 3.总结 下面把整个squid.conf总结一下: # 服务器配置 http_port 192.168.0.1:3128 cache_mgr start@soocol.com cache_dir null /tmp cache_access_log /var/squid/access.log cache_log /var/squid/cache.log cache_store_log /var/squid/store.log visible_hostname No1.proxy client_mask 255.255.255.255 httpd_accel_host virtual httpd_accel_port 80 httpd_accel_with_proxy on httpd_accel_user_host_header on # 用户分类 acl advance arp 00:01:02:1f:2c:3e 00:01:02:3c:1a:8b ... acl normal proxy_auth REQUIED acl all src 0.0.0.0 # 行为分类 acl mmxfile urlpath_regex \.mp3$ \.avi$ \.exe$ acl conncount maxconn 3 acl worktime time MTWHF 8:30-12:00 14:00-18:00 acl sinapage dstdomain ok.sina.com.cn acl qq dstdomain .tcccent.com.cn # 处理 http_access allow advance http_access deny conncount normal http_access deny !worktime http_access deny mmxfile http_access deny sinapage http_access deny qq http_access allow normal 配置后的状况是,advance组可以不受任何限制地访问Internet,而normal组则只能在工作时间上网,而且不能下载多媒体文件,不能访问某些特定的站点,而且发送请求不能超过3个。