squid 不能hit

squid 不能hit

甜扑 发布于 2021-12-01 字数 3597 浏览 791 回复 3

@皮总 你好,想跟你请教个问题:

@皮总 你好,想跟你请教个问题:

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

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

扫码加入群聊

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

兮颜 2021-12-01 3 楼

皮总:

reload-into-ims ignore-no-cache ignore-reload ignore-private

加上这样就是永久缓存了

听说蓝汛和网宿的cdn是可以根据源站的expires时间来缓存的,这个squid可以设置吗?

终止放荡 2021-12-01 2 楼

reload-into-ims ignore-no-cache ignore-reload ignore-private 加上这样就是永久缓存了 听说蓝汛和网宿的cdn是可以根据源站的expires时间来缓存的,这个squid可以设置吗?

英雄似剑 2021-12-01 1 楼

我觉得问题在于 你源站的一些缓存 头或者 Meta 信息。贴出来看看

另外就是refresh_pattern  加上这几个参数看看,示例如下

refresh_pattern -i .jpg$       1440    90%     129600  reload-into-ims ignore-no-cache ignore-reload ignore-private