配置如下
代码如下 | 复制代码 |
http_port 142.4.106.1:3128 http_port 142.4.106.xx:3128 http_port 142.4.106.xx:3128 auth_param basic program /user/lib/squid/libexec/ncsa_auth /etc/squid/passwd auth_param basic children 5 auth_param basic realm Squid proxy-caching web server auth_param basic credentialsttl 12 hours auth_param basic casesensitive off #使用用户或者用户组来确定出口的IP #acl wltony proxy_auth wltony #acl wltony1 proxy_auth wltony1 #tcp_outgoing_address 142.4.106.xxx wltony #根据被访问服务器 IP 来确定出口IP #acl no1 myip 142.4.106.xxx #tcp_outgoing_address 142.4.106.xxx no1 acl src_73 src 142.4.106.xxx acl src_74 src 142.4.106.xxx tcp_outgoing_address 142.4.106.xxx src_73 tcp_outgoing_address 142.4.106.xxx src_74 #first_req 为主访问IP acl first_req src 142.4.106.1 acl second_req src 142.4.106.xxx acl second_req src 142.4.106.xxx cache_peer 142.4.106.xxx parent 3128 0 round-robin no-query login=wltony:xxx cache_peer 142.4.106.xxx parent 3128 0 round-robin no-query login=wltony:xxx cache_peer_access 142.4.106.xxx allow first_req cache_peer_access 142.4.106.xxx allow first_req cache_peer_access 142.4.106.xxx deny second_req cache_peer_access 142.4.106.xxx deny second_req never_direct allow first_req never_direct deny second_req #close cache www.111cn.net acl NCACHE method GET no_cache deny NCACHE acl ncsa_users proxy_auth REQUIRED acl all src all header_access Via deny all header_access X-Forwarded-For deny all http_access allow ncsa_users #http_access allow wltony #http_access allow wltony1 http_access deny all |
时间: 2024-10-27 16:15:38