User Tools

Site Tools


pfsense:squid:refresh_patterns

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
pfsense:squid:refresh_patterns [2020/03/15 11:20] peterpfsense:squid:refresh_patterns [2020/07/15 09:30] (current) – external edit 127.0.0.1
Line 9: Line 9:
  
 Unfortunately, the directions given by most servers are the Web servers’ defaults, and do not produce significant bandwidth savings. Unfortunately, the directions given by most servers are the Web servers’ defaults, and do not produce significant bandwidth savings.
 +
  
 ---- ----
 +
 +===== Master Refresh Pattern =====
 +
 +
 +[[PFSense:Squid:Refresh Patterns:Squid Refresh Patterns Master List|Squid Refresh Patterns Master List]]
 +
 +----
 +
 +===== Other Squid Refresh Patterns =====
 +
 +[[PFSense:Squid:Refresh Patterns:Squid Refresh Patterns - Anti-Virus|Squid Refresh Patterns - Anti-Virus]]
 +
 +[[PFSense:Squid:Refresh Patterns:Squid Refresh Patterns - Facebook|Squid Refresh Patterns - Facebook]]
 +
 +[[PFSense:Squid:Refresh Patterns:Squid Refresh Patterns - Microsoft|Squid Refresh Patterns - Microsoft]]
 +
 +[[PFSense:Squid:Refresh Patterns:Squid Refresh Patterns - Ubuntu|Squid Refresh Patterns - Ubuntu]]
 +
 +[[PFSense:Squid:Refresh Patterns:Squid Refresh Patterns - YouTube|Squid Refresh Patterns - YouTube]]
 +
 +[[PFSense:Squid:Refresh Patterns:Squid Refresh Patterns - Catch-All|Squid Refresh Patterns - Catch-All]]
 +
 +
 +----
 +
  
 ===== Refresh Pattern Format ===== ===== Refresh Pattern Format =====
Line 58: Line 84:
 refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^ftp: 1440 20% 10080
 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern ^gopher: 1440 0% 1440
-refresh_pattern -i .(gif|png|jpg|jpeg|ico)$ 10080 90% 43200 override-expire ignore-no-cache ignore-no-store ignore-private +refresh_pattern -i .(gif|png|jpg|jpeg|ico)$ 10080 90% 43200                               override-expire ignore-no-cache ignore-no-store ignore-private 
-refresh_pattern -i .(iso|avi|wav|mp3|mp4|mpeg|swf|flv|x-flv)$ 43200 90% 432000 override-expire ignore-no-cache ignore-no-store ignore-private +refresh_pattern -i .(iso|avi|wav|mp3|mp4|mpeg|swf|flv|x-flv)$ 43200 90% 432000            override-expire ignore-no-cache ignore-no-store ignore-private 
-refresh_pattern -i .(deb|rpm|exe|zip|tar|tgz|ram|rar|bin|ppt|doc|tiff)$ 10080 90% 43200 override-expire ignore-no-cache ignore-no-store ignore-private+refresh_pattern -i .(deb|rpm|exe|zip|tar|tgz|ram|rar|bin|ppt|doc|tiff)$ 10080 90% 43200   override-expire ignore-no-cache ignore-no-store ignore-private
 refresh_pattern -i .index.(html|htm)$ 0 40% 10080 refresh_pattern -i .index.(html|htm)$ 0 40% 10080
 refresh_pattern -i .(html|htm|css|js)$ 1440 40% 40320 refresh_pattern -i .(html|htm|css|js)$ 1440 40% 40320
Line 115: Line 141:
  
 Install a caching DNS server on your server and have Squid use it so as to cut down on your DNS requests.  This [[http://www.httpcompression.net/howtos/pdnsd.html|how-to]] may be helpful. Install a caching DNS server on your server and have Squid use it so as to cut down on your DNS requests.  This [[http://www.httpcompression.net/howtos/pdnsd.html|how-to]] may be helpful.
- 
----- 
- 
-===== Squid Refresh Patterns - Facebook ===== 
- 
-<code> 
-# Facebook Images. 
-refresh_pattern -i fbcdn.*net\/.*\.((jp(e?g|e|2)|gif|pn[pg]|bm?|tiff?|ico|swf|css|js)|(jp(e?g|e|2)|gif|pn[pg]|bm?|tiff?|ico|swf|css|js)(\?|.*$)) 241920 99% 241920 ignore-no-store ignore-private override-expire override-lastmod reload-into-ims ignore-auth 
-refresh_pattern -i pixel\.facebook\.com.*\.(jpg|png|gif|ico|css|js) 241920 80% 241920 override-expire ignore-reload reload-into-ims ignore-auth 
-refresh_pattern -i \.akamaihd\.net.*\.(jpg|png|gif|ico|css|js) 241920 80% 241920 override-expire ignore-reload reload-into-ims ignore-auth 
-refresh_pattern -i ((facebook.com)|(85.131.151.39))\.(jpg|png|gif) 241920 99% 241920 ignore-reload override-expire ignore-no-store store-stale 
-refresh_pattern -i fbcdn\.net\/.*\.((jp(e?g|e|2)|gif|pn[pg]|bm?|tiff?|ico|swf|css|js)|(jp(e?g|e|2)|gif|pn[pg]|bm?|tiff?|ico|swf|css|js)(\?|.*$)) 241920 99% 241920 ignore-no-store ignore-private override-expire override-lastmod reload-into-ims ignore-auth 
-refresh_pattern static\.(xx|ak)\.fbcdn\.net*\.(jpg|gif|png) 241920 99% 241920 ignore-reload override-expire ignore-no-store 
-refresh_pattern ^https?\:\/\/profile\.ak\.fbcdn.net*\.(jpg|gif|png) 241920 99% 241920 ignore-reload override-expire ignore-no-store 
- 
-# Facebook Video. 
-refresh_pattern -i \.video.ak.fbcdn.net.*\.(mp4|flv|mp3|amf)                    10080 80% 43200 override-expire ignore-reload reload-into-ims ignore-private ignore-no-store ignore-must-revalidate 
-refresh_pattern (audio|video)\/(webm|mp4) 129600 99% 129600 ignore-reload override-expire override-lastmod ignore-must-revalidate  ignore-private ignore-no-store ignore-auth store-stale 
-refresh_pattern -i ^http://.*squid\.internal.*  241920 100% 241920 override-lastmod override-expire ignore-reload ignore-must-revalidate ignore-private ignore-no-store ignore-auth store-stale 
-</code> 
- 
----- 
- 
-===== Squid Refresh Patterns - Microsoft ===== 
- 
-Sites like Microsoft’s windowsupdate.com, which virtually all Windows PCs update their OS from, are among the most bandwidth-intensive sites on some networks. 
- 
-Unfortunately, they are not cacheable because they offer partial responses (http return code 206), which Squid presently does not cache. 
- 
-Where you have control over the client machines, you can install Microsoft’s Update Server to handle caching for windowsupdate. 
- 
-If you cannot use the Update Server, you can use Squid’s delay pools — a bandwidth management technique — to limit the portion of bandwidth that windowsupdate consumes during your peak periods. 
- 
-The clients will then have to be online during off-peak periods to complete their updates. 
- 
-Below, we configure one global delay pool at 64Kbps (8KBps). 
- 
-Traffic for which the ACL of destination domain is windowsupdate.com during the peak period of 10:00-16:00 will be limited to 64Kbps. 
- 
-<code> 
-acl winupdate dstdomain .windowsupdate.com 
-acl peakperiod time 10:00-16:00 
-delay_pools 1 
-delay_class 1 1 
-# 64 Kbit/s 
-delay_parameters 1 8000/8000 
-delay_access 1 allow winupdate peakperiod 
-</code> 
- 
-After making changes like the ones above, Squid’s byte hit rate increased from about 8% to between 26-37%.  If you are doing 33%, it means a third of all traffic is coming from your cache, and not from slower links across the Internet. 
- 
----- 
- 
- 
-===== Squid Refresh Patterns - YouTube ===== 
- 
-<code> 
-# Youtube Video. 
-refresh_pattern -i (get_video\?|videoplayback\?|videodownload\?|\.mp4|\.webm|\.flv|((audio|video)\/(webm|mp4))) 241920 100% 241920 override-expire ignore-reload ignore-private ignore-no-store ignore-must-revalidate reload-into-ims ignore-auth store-stale 
-refresh_pattern -i ^https?\:\/\/.*\.googlevideo\.com\/videoplayback.*     10080 99% 43200 override-lastmod override-expire ignore-reload reload-into-ims ignore-private reload-into-ims ignore-auth store-stale 
-refresh_pattern -i ^https?\:\/\/.*\.googlevideo\.com\/videoplayback.*$    241920 100% 241920 override-expire ignore-reload ignore-private ignore-no-store ignore-must-revalidate reload-into-ims ignore-auth store-stale 
- 
-# Youtube images. 
-refresh_pattern -i (yimg|twimg)\.com\.*         1440 100% 129600 override-expire ignore-reload reload-into-ims 
-refresh_pattern -i (ytimg|ggpht)\.com\.*        1440 80% 129600 override-expire override-lastmod ignore-auth ignore-reload reload-into-ims 
-</code> 
- 
----- 
- 
-===== Squid Refresh Patterns - Catch-All ===== 
- 
-This should be at the end. 
- 
-<code> 
-# All Files. 
-refresh_pattern -i \.(3gp|7z|ace|asx|bin|deb|divx|dvr-ms|ram|rpm|exe|inc|cab|qt) 10080 80% 10080 override-expire override-lastmod reload-into-ims 
-refresh_pattern -i \.(rar|jar|gz|tgz|bz2|iso|m1v|m2(v|p)|mo(d|v)|arj|lha|lzh|zip|tar|iop|nzp|pak|mar|msp) 10080 80% 10080 override-expire override-lastmod reload-into-ims ignore-reload 
-refresh_pattern -i \.(jp(e?g|e|2)|gif|pn[pg]|bm?|tiff?|ico|swf|dat|ad|txt|dll) 10080 80% 10080 override-expire override-lastmod reload-into-ims 
-refresh_pattern -i \.(avi|ac4|mp(e?g|a|e|1|2|3|4)|mk(a|v)|ms(i|u|p)|og(x|v|a|g)|rm|r(a|p)m|snd|vob|webm) 10080 80% 10080 override-expire override-lastmod reload-into-ims 
-refresh_pattern -i \.(pp(t?x)|s|t)|pdf|rtf|wax|wm(a|v)|wmx|wpl|cb(r|z|t)|xl(s?x)|do(c?x)|flv|x-flv) 10080 80% 10080 override-expire override-lastmod reload-into-ims 
-refresh_pattern .  0 20% 4320 
-</code> 
  
 ---- ----
Line 208: Line 152:
  
 ===== References ===== ===== References =====
 +
 +http://www.squid-cache.org/
 +
 +https://www.linux.com/news/speed-your-internet-access-using-squids-refresh-patterns/
  
 http://www.squid-cache.org/Doc/config/refresh_pattern/ http://www.squid-cache.org/Doc/config/refresh_pattern/
pfsense/squid/refresh_patterns.1584271231.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki