@皮总 你好,想跟你请教个问题:
@皮总 你好,想跟你请教个问题:
squid 3.5.4版本,没有命中hit,日志中总是 TCP_REFRESH_UNMODIFIED:ROUNDROBIN_PARENT
http_port 80 accel vport
cache_effective_user squid
cache_effective_group squid
max_filedescriptors 1000000
dns_nameservers 223.5.5.5
#client_persistent_connections on
#server_persistent_connections on
#forward_timeout 4 minutes
#connect_timeout 3 minutes
#read_timeout 15 minutes
#request_timeout 3 minute
#peer_connect_timeout 1 minute
#persistent_request_timeout 3 minutes
#pconn_timeout 3 minute
#client_lifetime 1 days
##minimum_expiry_time 0 seconds
acl src_localhost src all
acl mgrhost src 10.0.0.0/8
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 3335 # multiling http
acl CONNECT method CONNECT
acl Purge method PURGE
http_access allow Purge mgrhost
http_access allow all
http_access allow mgrhost
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_reply_access allow all
#logfile_rotate 5
#forwarded_for on
#log_icp_queries on
#request_header_access Via deny all
#request_header_access Server deny all
#request_header_access X-Cache-Lookup deny all
cache_mem 1 GB
cache_dir aufs /data0/cache 20000 16 256
cache_swap_low 90
cache_swap_high 95
maximum_object_size 204800 KB
maximum_object_size_in_memory 2048 KB
#cache_replacement_policy lru
#memory_replacement_policy lru
logformat combined "%{X-Forwarded-For}>h" %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %<Hs %>Hs %<st "%{Referer}>h" "%{User-Agent}>h" "%{mynet}>h" %Ss:%Sh
access_log /application/search/local/squid3.5.4/var/logs/access.log combined
cache_log /application/search/local/squid3.5.4/var/logs/cache.log
cache_store_log none
pid_filename /application/search/local/squid3.5.4/var/logs/squid.pid
coredump_dir /application/search/local/squid3.5.4/var/logs/
#acl newsso url_regex -i ^http://
#cache_peer_access nginx allow newsso
#refresh_pattern -i (\.gif$|\.jpg$|\.jpeg$|\.png$|\.bmp$|\.css$|\.js$) 10 0% 10
#refresh_pattern -i \.html$ 3 0% 3
#refresh_pattern -i (/zuixin/|/guonei/|/guoji/|/hulianwang/|/fazhi/|/shehui/|/junshi/|/tiyu/|/caijing/|/keji/|/jiaoyu/|/wenyu/|/qiche/|/fangchan/|/shipin/) 5 0% 5
refresh_pattern -i (/GN/|/DF/|/GJ/|/CJ/|/JS/|/TY/|/WY/|/HLW/|/FZ/|/SH/|/KJ/|/JY/|/SP/|/QC/|/FC/) 20 100% 20
# override-expire override-lastmod reload-into-ims
#refresh_pattern -i . 15 0% 15
#negative_ttl 1 seconds
error_directory /application/search/local/squid3.5.4/share/errors/en-us
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
我觉得问题在于 你源站的一些缓存 头或者 Meta 信息。贴出来看看
另外就是refresh_pattern 加上这几个参数看看,示例如下
refresh_pattern -i \.jpg$ 1440 90% 129600 reload-into-ims ignore-no-cache ignore-reload ignore-private######reload-into-ims ignore-no-cache ignore-reload ignore-private 加上这样就是永久缓存了 听说蓝汛和网宿的cdn是可以根据源站的expires时间来缓存的,这个squid可以设置吗?######
皮总:
reload-into-ims ignore-no-cache ignore-reload ignore-private
加上这样就是永久缓存了
听说蓝汛和网宿的cdn是可以根据源站的expires时间来缓存的,这个squid可以设置吗?
######皮总: 按你的添加了 refresh_pattern -i (/GN/|/DF/|/GJ/|/CJ/|/JS/|/TY/|/WY/|/HLW/|/FZ/|/SH/|/KJ/|/JY/|/SP/|/QC/|/FC/) 20 100% 20 reload-into-ims 但是日志还是 TCP_REFRESH_UNMODIFIED:ROUNDROBIN_PARENT######那你只加 reload-into-ims 就有这效果,Squid 请求 Web Server的时候就带上 If-Modified-Since 头。