Squid如何配置为缓存所有下载的文件?
问题描述:
我正在尝试设置一个Squid代理实例,以便它可以与Test Kitchen一起用于厨师食谱开发。Squid如何配置为缓存所有下载的文件?
当Test Kitchen加入虚拟机时,通过下载它来安装chef-client
。我配置了它,以便通过代理服务器进行下载,但Squid不缓存下载的文件,例如
我认为这也许到它通过SSL被访问,但我不是100%肯定。这是因为apt
在Ubuntu虚拟机配置为使用相同的代理实例,我得到的缓存命中这些文件:
这里是我的squid.conf
文件:
http_port 3128
acl manager url_regex -i ^cache_object:// +i ^https?://[^/]+/squid-internal-mgr/
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl localnet src 10.0.0.0/8 # RFC 1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC 1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC 1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access allow localnet
http_access deny all
maximum_object_size 1024 MB
cache_replacement_policy heap LFUDA
cache_dir aufs /var/spool/squid3 5000 24 256
coredump_dir /var/spool/squid3
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern Packages\.bz2$ 0 20% 4320 refresh-ims
refresh_pattern Sources\.bz2$ 0 20% 4320 refresh-ims
refresh_pattern Release\.gpg$ 0 20% 4320 refresh-ims
refresh_pattern Release$ 0 20% 4320 refresh-ims
refresh_pattern -i .(deb|rpm|exe|zip|tar|tgz|bz2|ram|rar|bin)$ 129600 100% 129600 override-expire ignore-no-cache ignore-no-store
refresh_pattern . 0 20% 4320
不任何人都知道我需要添加到配置中,以便它可以缓存chef-client
的下载?它是一个SSL链接吗?
答
可能出现这种情况,我已经确定这确实与SSL有关。
原因是SSL是为了给予隐私的期望,所以默认情况下,squid不缓存受保护的页面,因为它看不到它们。
由于我只打算使用这个软件包的缓存我有两个选择:
- 下载
chef-client
使用普通的HTTP URL - 创建一个自签名证书鱿鱼是在一个男人中间,所以它可以解密传入的数据并缓存它。
数字1目前较为容易,而数字2在长期内可能更为稳健。