Squid 設定-Windows Update(二)

Windows Update (WU)實在是有夠難設定 cache 的。下面是我設定的步驟,這樣設定確實可以將 WU 要下載的檔案存在 Squid 的 cache 內,不過我相信不用這麼複雜。不過,等有時間再來慢慢試驗囉!

  1. 設定 Proxy:
  2. 測試過,不管 IE 怎麼設定,WU 就是只抓 proxycfg 裡面的設定

  3. refresh_pattern 設定:
  4. 因為聽說 WU 會使用 no-cache,避免檔案不同步或是被植入木馬,所以會需要特別在 refresh_pattern 設定 "reload-into-ims"
    後來我的設定是:

    refresh_pattern -i \.exe$       259200  80%     259200  reload-into-ims ignore-reload   override-expire override-lastmod
    refresh_pattern -i .*windowsupdate.com.*        259200  80%     259200  reload-into-ims ignore-reload   override-expire override-lastmod
    refresh_pattern -i .*microsoft.com.*    259200  80%     259200  reload-into-ims override-lastmod
    refresh_pattern -i \.nup$       259200  80%     259200  ignore-reload   override-expire
    refresh_pattern .               1440    20%     10080   override-lastmod

    (一開始沒注意到 refresh pattern 也是先符合先決,害我一直失敗)

  5. minimum_object_size:
  6. 當初因為硬碟太小,所以設定 minimum_object_size 5 KB 避免抓下一堆小圖片,沒想到 WU 在抓取檔案的時候,會分成 HEAD 和 GET,而 HEAD 不到 1KB,所以後來把 minimum_object_size 註解掉。

    [2009/10/30 08:05:41] 192.168.51.37 TCP_HIT:NONE 568+293=861 "HEAD http://download.windowsupdate.com/msdownload/update/software/secu/2009/08/ndp20sp2-kb974417-x86_c8d08aa227c88b7ed915b839eff3e8c0d2f67e06.exe TCP_HIT:NONE HTTP/1.1" 200 568 - -
    [2009/10/30 08:05:42] 192.168.51.37 TCP_HIT:NONE 11460496+292=11460788 "GET http://download.windowsupdate.com/msdownload/update/software/secu/2009/08/ndp20sp2-kb974417-x86_c8d08aa227c88b7ed915b839eff3e8c0d2f67e06.exe TCP_HIT:NONE HTTP/1.1" 200 11460496 - -
  7. 其他哩哩扣扣的設定:
  8. 其他像 maximum_object_size、maximum_object_size_in_memory、range_offset_limit 應該影響不大。

後面是目前的設定檔:

acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
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 all
icp_access allow localnet
icp_access deny all
http_port 8080
hierarchy_stoplist cgi-bin ?
cache_mem 256 MB
maximum_object_size_in_memory 128 MB
cache_dir ufs /usr/local/squid/cache 51000 16 256
maximum_object_size 128 MB
cache_swap_low 90
cache_swap_high 95
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
logformat denniswave [%{%Y/%m/%d %H:%M:%S}tl] %>a %Ss:%Sh %<st+%>st=%st "%rm %ru %Ss:%Sh HTTP/%rv" %Hs %<st %ui %un
access_log /usr/local/squid/logs/access.log denniswave
cache_log /usr/local/squid/logs/cache.log
cache_store_log /usr/local/squid/logs/store.log
logfile_rotate 10
debug_options ALL,1
refresh_pattern -i \.exe$       259200  80%     259200  reload-into-ims ignore-reload   override-expire override-lastmod
refresh_pattern -i .*windowsupdate.com.*        259200  80%     259200  reload-into-ims ignore-reload   override-expire override-lastmod
refresh_pattern -i .*microsoft.com.*    259200  80%     259200  reload-into-ims override-lastmod
refresh_pattern -i \.nup$       259200  80%     259200  ignore-reload   override-expire
refresh_pattern .               1440    20%     10080   override-lastmod
range_offset_limit 32 MB
request_entities on
visible_hostname        proxy.my.domain
icp_port 3130
coredump_dir /usr/local/squid/cache
Please follow and like us:

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *