分享下自己测试squid缓存节点配置文件:

squid版本:

Squid Cache: Version 3.1.5

http_port 80 vhost
http_port 8080 vhost vport
icp_port 0
unique_hostname host57
dns_nameservers  192.168.1.100

cache_dir aufs /data/cache/cache1 40960 16 256 max-size=204800
cache_dir aufs /data/cache/cache2 40960 16 256 max-size=204800

logformat  cdn  %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st %tr "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
cache_log /data/cache/logs/cache.log
access_log /data/cache/logs/access.log  cdn
cache_store_log none

cache_effective_user squid
cache_effective_group  squid
tcp_recv_bufsize 65535 bytes
logfile_rotate 4

pid_filename /usr/local/squid/var/logs/squid.pid

cache_mem  2048 MB
cache_swap_low 85
cache_swap_high 95

maximum_object_size 4096 KB
maximum_object_size_in_memory 512 KB
reply_body_max_size 5116 KB
minimum_object_size 1 bytes

ipcache_size 65535
fqdncache_size 65535
cache_replacement_policy heap LFUDA
memory_replacement_policy heap LFUDA

request_header_max_size 32 KB
quick_abort_min -1 KB
read_ahead_gap 16 KB
negative_ttl 0 minutes
range_offset_limit -1 KB
client_lifetime 60 minutes
half_closed_clients off
pconn_timeout 100 seconds
shutdown_lifetime 20 seconds

cache_mgr admin@5iqiong.com
httpd_suppress_version_string off
visible_hostname 51cdn.cn
memory_pools_limit 64 MB
via off

forwarded_for on
store_avg_object_size 32 KB
store_objects_per_bucket 256
strip_query_terms off
coredump_dir /data/cache/logs

################Purge#########################
acl AdminBoxes src 127.0.0.1
acl Purge method PURGE
http_access allow AdminBoxes Purge
http_access deny Purge

hierarchy_stoplist cgi-bin ?
hierarchy_stoplist -i ^https:\\ ?
acl QUERY urlpath_regex -i cgi-bin \? \.php \.xml \.jsp \.js \.do
acl denyssl urlpath_regex -i ^https:\\
acl dy_cache urlpath_regex swf\?
acl dy_cache urlpath_regex html\?
acl dy_cache urlpath_regex htm\?
acl dy_cache urlpath_regex exe\?
acl dy_cache urlpath_regex css\?
acl dy_cache urlpath_regex js\?
acl dy_cache urlpath_regex cab\?
acl dy_cache urlpath_regex asp\?
acl dy_cache urlpath_regex aspx\?
acl dy_cache urlpath_regex php\?
acl dy_cache urlpath_regex jsp\?

acl dy_page url_regex -i ^http:\/\/www1\.5iqiong\.com\/.*\?.*$
acl dy_page url_regex -i ^http:\/\/www2\.5iqong\.com\/.*\?.*$

no_cache deny QUERY
no_cache deny denyssl
no_cache deny dy_cache
no_cache deny dy_page

acl www dstdomain .5iqiong.com
always_direct allow www
http_access allow www

##############Refresh_pattern#################
refresh_pattern -i ^http:\/\/(www1|www2)\.5iqiong\.com\/.*\.(html|jpeg|bmp|png|gif)  120 100%  240 reload-into-ims
refresh_pattern -i \/$ 15 90% 600 reload-into-ims
refresh_pattern -i \.html$ 15 90% 60 reload-into-ims
refresh_pattern -i \.htm$ 15 90% 600 reload-into-ims
refresh_pattern -i \.shtml$ 15 90% 600 reload-into-ims
refresh_pattern -i \.vhtml$ 30 90% 600 reload-into-ims
refresh_pattern -i \.hml$ 15 90% 600 reload-into-ims
refresh_pattern -i \.php$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.asp$ 15 90% 600 reload-into-ims
refresh_pattern -i \.jsp$ 1440 90% 8640 reload-into-ims
refresh_pattern -i \.gif$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.swf$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.jpg$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.png$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.bmp$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.js$ 120 90% 600 reload-into-ims
refresh_pattern -i \.css$ 120 90% 600 reload-into-ims
refresh_pattern -i \.wma 1440 90% 21600 reload-into-ims
refresh_pattern -i \.zip 1440 90% 21600 reload-into-ims
refresh_pattern -i \.mp3 1440 90% 21600 reload-into-ims
refresh_pattern -i \.rar 1440 90% 21600 reload-into-ims
refresh_pattern -i \.flv$ 1440 90% 21600 reload-into-ims
refresh_pattern -i \.wmv$ 1440 90% 21600 reload-into-ims
refresh_pattern -i \.exe$ 1440 90% 21600 reload-into-ims
refresh_pattern .               0       20%     4320

acl manager proto cache_object
acl ownhost src 192.168.1.0/24
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl Safe_ports port 8080    # proxy
acl Safe_ports port 80      # Web
acl SSL_ports port  443     #https
acl CONNECT method CONNECT

http_access allow ownhost
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny all
icp_access allow  all

##############http-header###############################
reply_header_access Via deny all
reply_header_access Cache-Control deny all
reply_header_access Server deny all
reply_header_access X-Squid-Error deny all
reply_header_access X-Forwarded-For deny all
request_header_access Via deny all
request_header_access Age deny all
request_header_access X-Squid-Error deny all
request_header_access Pragma deny all
#request_header_access X-Forwarded-For deny all