squid2.7緩存no-cache問題
我的squid2.7配置文件(實驗環境)
mime_table /usr/local/squid/etc/mime.conf
# Squid 伺服器監聽本機80 埠,支持域名和IP的虛擬主機。
http_port 80 vhost vport
# 代理到192.168.1.1主機的81口和192.168.1.2的80口
cache_peer 192.168.0.141 parent 80 0 no-query originserver no-digest name=b round-robin
#cache_peer 192.168.0.242 parent 80 0 no-query originserver no-digest name=d round-robin
#訪問的網址與相對應代理到的主機。
#cache_peer_domain b 192.168.0.141
cache_peer_domain b www.liuxin.com
#cache_peer_domain d www.xinliuu.com
# 緩存目錄
cache_dir ufs /usr/local/squid/var/cache 10000 16 256
cache_log /usr/local/squid/var/logs/cache.log
access_log /usr/local/squid/var/logs/access.log squid
#緩存設置
cache_mem 1024 MB
max_open_disk_fds 0
minimum_object_size 0 KB
maximum_object_size 32 MB
maximum_object_size_in_memory 2048 KB
cache_swap_low 90
cache_swap_high 95
acl all src 0.0.0.0/0.0.0.0
http_access allow all
以下是一個html文件代碼
<html>
<title>Welcome to testzh!</title>
<head>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="cache-control" content="no-store" />
</head>
<body bgcolor="blue" text="red">
<center><h1>Welcome to testzh </h1></center>
</body>
</html>
squid可以緩存,把WEB伺服器關了以後,仍然可以訪問html的文件,理論上來說html加上no-cache就可以不緩存這個html文件了,但還是能,所以一直不清楚,找了幾天,加了啥都沒用,放入指點。
《解決方案》
是否你瀏覽器的緩存呢?看看squid的日誌里怎麼說。