我刚刚在 Ubuntu 14.04 上安装了 3.3.8。但是我发现 squid3 根本不缓存任何静态图像文件。
这是我的 squid3.conf
auth_param digest program /usr/lib/squid3/digest_file_auth -c /etc/squid3/passwords
auth_param digest realm proxy
acl authenticated proxy_auth REQUIRED
acl local src 127.0.0.1/32
acl ukpro src "/etc/squid3/ukip.txt"
http_access allow ukpro
http_access allow local
http_access allow authenticated
http_port 3128
cache_dir ufs /var/spool/squid3 3072 16 256
minimum_object_size 1 KB
maximum_object_size 1 MB
cache_swap_low 87
cache_swap_high 90
memory_pools off
netdb_filename none
pinger_enable off
#refresh_pattern -i .jpg$ 0 60% 1440 ignore-no-cache ignore-no-store reload-into-ims
#strip_query_terms off
refresh_pattern -i \.(gif|png|jpg|jpeg|ico)$ 1440 100% 525949 override-expire ignore-reload ignore-no-cache ignore-no-store ignore-must-revalidate ignore-private ignore-auth
以下是始终显示 TCP_MISS/200 的日志(相同的图像网址):
1414349354.186 644 127.0.0.1 TCP_MISS/200 97198 GET http://heartmindandseoul.com/wp-content/uploads/2013/03/squid3.jpg - HIER_DIRECT/173.254.28.23 image/jpeg
1414349358.061 500 127.0.0.1 TCP_MISS/200 97198 GET http://heartmindandseoul.com/wp-content/uploads/2013/03/squid3.jpg - HIER_DIRECT/173.254.28.23 image/jpeg
1414349359.782 624 127.0.0.1 TCP_MISS/200 97198 GET http://heartmindandseoul.com/wp-content/uploads/2013/03/squid3.jpg - HIER_DIRECT/173.254.28.23 image/jpeg
1414349377.096 659 127.0.0.1 TCP_MISS/200 97198 GET http://heartmindandseoul.com/wp-content/uploads/2013/03/squid3.jpg - HIER_DIRECT/173.254.28.23 image/jpeg
1414349725.175 652 127.0.0.1 TCP_MISS/200 97198 GET http://heartmindandseoul.com/wp-content/uploads/2013/03/squid3.jpg - HIER_DIRECT/173.254.28.23 image/jpeg
1414349727.522 514 127.0.0.1 TCP_MISS/200 97198 GET http://heartmindandseoul.com/wp-content/uploads/2013/03/squid3.jpg - HIER_DIRECT/173.254.28.23 image/jpeg
有人能给我一些建议吗?谢谢。
答案1
删除minimum_object_size
会导致立即出现 HIT,首先是在内存中,然后在重新启动服务器后出现在磁盘上,我无法真正解释原因(这没有意义,因为图像比这大得多)但至少这解决了你的问题。