Caching Google Maps Dengan Squid


Oke, saya tau mungkin topik ini rada basi atau sudah banyak yang tau. Tapi sekedar untuk dokumentasi dan sharing untuk yang belum tau teknik cache Google maps dengan squid cache, maka saya kembali menuliskannya disini. Teknik ini membantu anda yang mencoba untuk memaksa Google maps (termasuk gambar-gambar Google earth, satellite, street views, atau location) agar dapat di cache dengan baik dengan menggunakan squid-2.7stable9.

Teknik ini bekerja dengan baik pada squid-2.7stable9 karena menggunakan fitur storeurl yang terintegrasi di squid versi ini.

How-to…

Pertama tambahkan pada squid.conf acl yang berisi regex (sub)domain google yang digunakan untuk “menyimpan” gambar-gambar untuk google maps, earth/satellite, street views, dan location. Kemudian, “kirimkan” ke script storeurl untuk kemudian di proses oleh squid.

# map, earth/satellite, street views, and location images, respectively.
acl gmapserver url_regex mt[0-9]?.google.co(m|\.id)
acl gmapserver url_regex khm[0-9]?.google.co(m|\.id)
acl gmapserver url_regex kh[0-9]?.google.co(m|\.id)
acl gmapserver url_regex cbk[0-9]?.google.co(m|\.id)
acl gmapserver url_regex t[0-9]?.google.co(m|\.id)

# allow storeurl for gmapserver
storeurl_access allow gmapserver
storeurl_access deny all

# storeurl script
storeurl_rewrite_program /etc/squid/gmaps.pl
storeurl_rewrite_children 1
storeurl_rewrite_concurrency 10

Kemudian tambahkan refresh_pattern agar squid dapat melakukan caching google maps.

# let's violates http 
refresh_pattern -i (mt|kh|khm|cbk|t).*\.google\.co(m|.id) 10080 90% 21600 override-expire reload-into-ims ignore-private ignore-must-revalidate

Perlu dicatat, squid-2.7stable9 tidak akan melakukan caching untuk url yang terdapat “?” didalamnya. Oleh sebab itu, jangan lupa memberikan comment (memberikan tanda #) di depan baris konfigurasi seperti ini:

#We recommend you to use the following two lines.
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY

Selanjutnya buatlah storeurl rewriter, pada contoh diatas file tersebut adalah /etc/squid/gmaps.pl, dengan isi sebagai berikut :

#!/usr/bin/perl

$| = 1;
while (<>) {
    @X = split;
    $x = $X[0] . " ";
        # print STDERR $_ . "\n";
	if (m/^http:\/\/(kh|mt|khm|cbk|t)[0-9]?(.google\.co(m|\.id).*)/) {
		print $x . "http://" . $1  . $2 . "\n";
	} else {
		print $x . $X[1] . "\n";
	}
}

Setelah selesai jangan lupa melakukan chmod agar script ini bisa dijalankan: chmod +x /etc/squid/gmaps.pl

You are done! Lakukan squid -k reconfigure agar squid membaca ulang file konfigurasi yang anda telah buat sebelumnya.

Ujicoba

Silakan coba membuka halaman http://maps.google.co.id/ pada browser anda, kemudian buka kembali halaman tersebut pada browser lain sambil mengamati squid access.log. Jika caching berhasil maka anda akan melihat gambar map akan di hit oleh squid.

Contoh log (kondisi memory hit)

1363234537.280      5 10.20.30.130 TCP_MEM_HIT/200 59967 GET http://maps.google.co.id/ - NONE/- text/html
1363234537.494      0 10.20.30.130 TCP_MEM_HIT/200 830 GET http://maps.google.co.id/mapfiles/home3.html - NONE/- text/html
1363234537.524      0 10.20.30.130 TCP_MEM_HIT/200 14917 GET http://mt0.google.com/vt/lyrs=m@209000000&hl=id&src=app&x=26&y=15&z=5&s=Galil - NONE/- image/png
1363234537.524      0 10.20.30.130 TCP_MEM_HIT/200 13898 GET http://mt1.google.com/vt/lyrs=m@209000000&hl=id&src=app&x=25&y=15&z=5&s=Ga - NONE/- image/png
1363234537.525      0 10.20.30.130 TCP_MEM_HIT/200 14289 GET http://mt1.google.com/vt/lyrs=m@209000000&hl=id&src=app&x=25&y=16&z=5&s=Gal - NONE/- image/png
1363234537.525      2 10.20.30.130 TCP_MEM_HIT/200 29979 GET http://maps.google.co.id/images/experiments/nav_logo78.png - NONE/- image/png
1363234537.529      5 10.20.30.130 TCP_MEM_HIT/200 14133 GET http://mt0.google.com/vt/lyrs=m@209000000&hl=id&src=app&x=26&y=16&z=5&s=Galile - NONE/- image/png
1363234537.613      0 10.20.30.130 TCP_MEM_HIT/200 6070 GET http://mt1.google.com/vt/lyrs=m@209000000&hl=id&src=app&x=27&y=15&z=5&s= - NONE/- image/png
1363234537.618      0 10.20.30.130 TCP_MEM_HIT/200 2391 GET http://mt0.google.com/vt/lyrs=m@209000000&hl=id&src=app&x=26&y=17&z=5&s=Galileo - NONE/- image/png
1363234537.618      0 10.20.30.130 TCP_MEM_HIT/200 624 GET http://mt1.google.com/vt/lyrs=m@209000000&hl=id&src=app&x=25&y=17&z=5&s=Gali - NONE/- image/png
1363234537.618      0 10.20.30.130 TCP_MEM_HIT/200 8654 GET http://mt1.google.com/vt/lyrs=m@209000000&hl=id&src=app&x=27&y=16&z=5&s=G - NONE/- image/png
1363234537.618      0 10.20.30.130 TCP_MEM_HIT/200 11718 GET http://mt1.google.com/vt/lyrs=m@209000000&hl=id&src=app&x=27&y=17&z=5&s=Ga - NONE/- image/png

 Well, that’s all folks! :)


Related Posts

6 thoughts on “Caching Google Maps Dengan Squid

  1. diospada

    gan, bisa ditulis aja ngak setting buat squid.config nya? ane copas yg diatas ke squid.conf malah error :hammers maklum ane baru mulai belajar :o  misal buka google earth lewat applikasinya bkn pake browser masih bisa di cache gan..??

    Reply
    1. fazar Post author

      contoh konfigurasi minimum (harus disesuaikan dengan kondisi klien masbro agar mendapat performa squid yg maksimal)

      # Squid port
      http_port 3128 transparent

      # Google earth caching
      # Define (sub)domain for Google map, earth/satellite, street views, and location images
      acl gmapserver url_regex mt[0-9]?.google.co(m|\.id)
      acl gmapserver url_regex khm[0-9]?.google.co(m|\.id)
      acl gmapserver url_regex kh[0-9]?.google.co(m|\.id)
      acl gmapserver url_regex cbk[0-9]?.google.co(m|\.id)
      acl gmapserver url_regex t[0-9]?.google.co(m|\.id)

      # Allow storeurl for gmapserver
      storeurl_access allow gmapserver
      storeurl_access deny all

      # Storeurl script
      storeurl_rewrite_program /etc/squid/gmaps.pl
      storeurl_rewrite_children 1
      storeurl_rewrite_concurrency 10

      # Recommended minimum configuration:
      acl all src all
      acl manager proto cache_object
      acl localhost src 127.0.0.1/32
      acl to_localhost dst 127.0.0.0/8

      # Internal network
      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

      # Safe ports
      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

      # Recommended minimum configuration:
      # Only allow cachemgr access from localhost
      http_access allow manager localhost
      http_access deny manager

      # Deny requests to unknown ports
      http_access deny !Safe_ports

      # Deny CONNECT to other than SSL ports
      http_access deny CONNECT !SSL_ports
      http_access allow localnet

      # And finally deny all other access to this proxy
      http_access deny all

      # Logging
      access_log /var/log/cache/logs/access.log squid

      # Refresh patterns
      refresh_pattern -i (mt|kh|khm|cbk|t).*\.google\.co(m|.id) 10080 90% 21600 override-expire reload-into-ims ignore-private ignore-must-revalidate
      refresh_pattern ^ftp: 1440 20% 10080
      refresh_pattern ^gopher: 1440 0% 1440
      refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
      refresh_pattern . 0 20% 4320

      # Don't upgrade ShoutCast responses to HTTP
      acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
      upgrade_http0.9 deny shoutcast

      # Apache mod_gzip and mod_deflate known to be broken so don't trust
      # Apache to signal ETag correctly on such responses
      acl apache rep_header Server ^Apache
      broken_vary_encoding allow apache

      # Leave coredumps in the first cache dir
      coredump_dir /var/log/cache/cache

      Kemudian buatkan storeurl programnya : /etc/squid/gmaps.pl dan jangan lupa chmod +x /etc/squid/gmaps.pl

      Periksa file konfigurasi dengan mengetikkan squid -k parse (kalo ada kesalahan konfigurasi maka akan tampil disini)

      Terakhir lakukan squid -k reconfigure

      Jika masih ada error, coba masbro copas error nya kemari. Good luck.

      Reply
  2. diospada

    gak bisa gan, habis dicopas ke squid.config dibrowser gak bs konek :(
    (Kemudian buatkan storeurl programnya : /etc/squid/gmaps.pl dan jangan lupa chmod +x /etc/squid/gmaps.pl

    Periksa file konfigurasi dengan mengetikkan squid -k parse (kalo ada kesalahan konfigurasi maka akan tampil disini)

    Terakhir lakukan squid -k reconfigure)

    ^
    ^
    maksudnya gimana gan, bs pake bahasa awam aja? :o
    ane ngerti sebatas edit squid.config aja :hammers:

    mohon pencerahannya ya gan :beer:

    Reply
  3. fazar Post author

    @diospada,

    sebelumnya kan ada kita bikinkan file gmaps.pl, nah sesudah membuat file tersebut, ketikkan perintah berikut agar script nya bisa jalan :

    chmod +x /etc/squid/gmaps.pl

    sebelum me-restart atau me-reconfigure squid, ketikkan perintah berikut agar ketahuan jika ada konfigurasi yang salah :

    squid -k parse

    kalo nggak ada output (text yang keluar) berarti konfigurasi udah bener. sedangkan kalo ada konfigurasi yg salah, akan di output nya disini. demikian mas…

    Untuk memeriksa apakah ada error (misalnya nggak konek), silakan masbro periksa baris terakhir file /var/log/squid/cache.log

    semoga bisa dimengerti :)

    Reply
    1. diospada

      kok masih error ya gan.?? :cd
      ini ane copas aja deh settingan squid.conf ane :
      http_port 3128 transparent
      cache_mgr CeCePeBe
      forwarded_for off
      visible_hostname CCPB_SQUID_Proxy

      cache_mem 195 MB
      cache_dir ufs d:/squid/cache0 4259 10 256
      cache_dir ufs d:/squid/cache1 4259 10 256
      cache_dir ufs d:/squid/cache2 4259 10 256
      cache_dir ufs d:/squid/cache3 4259 10 256
      coredump_dir d:/squid

      #logformat squid %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%a %Ss/%03Hs %<st %rm %ru %un %Sh/%h] [%a %ui %un [%tl] “%rm %ru HTTP/%rv” %Hs %a %ui %un [%tl] “%rm %ru HTTP/%rv” %Hs %h” “%{User-Agent}>h” %Ss:%Sh
      access_log d:/squid/access.log squid
      cache_store_log none
      cache_log d:/squid/cache.log

      acl apache rep_header Server ^Apache
      broken_vary_encoding allow apache
      maximum_object_size 1000000000 KB
      maximum_object_size_in_memory 1024 KB

      negative_ttl 2 minutes
      half_closed_clients off
      #cache_swap_high 100%
      #cache_swap_low 80%

      ipcache_size 4096
      ipcache_low 95
      ipcache_high 100

      memory_pools off
      reload_into_ims on
      pipeline_prefetch on

      acl all src 0.0.0.0/0.0.0.0
      acl localNet src 192.168.0.0/24, 192.168.1.0/24, 192.168.10.0/24, 192.168.100.0/24
      acl manager proto cache_object
      acl localhost src 127.0.0.1/255.255.255.255
      acl to_localhost dst 127.0.0.0/8
      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

      # Yahoo! Messenger
      acl ym dstdomain .messenger.yahoo.com .psq.yahoo.com
      acl ym dstdomain .us.il.yimg.com .msg.yahoo.com .pager.yahoo.com
      acl ym dstdomain .rareedge.com .ytunnelpro.com .chat.yahoo.com
      acl ym dstdomain .voice.yahoo.com

      acl ymregex url_regex yupdater.yim ymsgr myspaceim

      # Other protocols Yahoo!Messenger uses ??
      acl ym dstdomain .skype.com .imvu.com

      # add from H4ck3rKu

      refresh_pattern ^http\:\/\/*\.facebook\.com\/ 10080 80% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/*\.kaskus\.us\/ 10080 80% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/*\.google\.co\*.*/ 10080 90% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/*\.yahoo\.co*\.*/ 10080 90% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/.*\.windowsupdate\.microsoft\.com\/ 10080 80% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/office\.microsoft\.com\/ 10080 80% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/windowsupdate\.microsoft\.com\/ 10080 80% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/w?xpsp[0-9]\.microsoft\.com\/ 10080 80% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/w2ksp[0-9]\.microsoft\.com\/ 10080 80% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/download\.microsoft\.com\/ 10080 80% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/download\.macromedia\.com\/ 10080 80% 43200 reload-into-ims
      refresh_pattern ^ftp\:\/\/ftp\.nai\.com/ 10080 80% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/ftp\.software\.ibm\.com\/ 10080 80% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/*\.friendster\.com\/ 10080 80% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/*\.detik\.com\/ 10080 80% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/*\.kaskus\.us\/ 10080 80% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/*\.google\.co\*.*/ 10080 90% 43200 reload-into-ims
      refresh_pattern ^http\:\/\/*\.yahoo\.co*\.*/ 10080 90% 43200 reload-into-ims

      refresh_pattern ^http://*.apps.facebook.*/.* 720 80% 4320
      refresh_pattern ^http://*.profile.ak.fbcdn.net/.* 720 80% 4320
      refresh_pattern ^http://*.creative.ak.fbcdn.net/.* 720 80% 4320
      refresh_pattern ^http://*.static.ak.fbcdn.net/.* 720 80% 4320
      refresh_pattern ^http://*.facebook.poker.zynga.com/.* 720 80% 4320
      refresh_pattern ^http://*.statics.poker.static.zynga.com/.* 720 80% 4320
      refresh_pattern ^http://*.zynga.*/.* 720 80% 4320
      refresh_pattern ^http://*.texas_holdem.*/.* 720 80% 4320
      refresh_pattern ^http://*.google.*/.* 720 80% 4320
      refresh_pattern ^http://*.indowebster.*/.* 720 80% 4320
      refresh_pattern ^http://*.4shared.*/.* 720 80% 4320
      refresh_pattern ^http://*.yahoo.com/.* 720 80% 4320
      refresh_pattern ^http://*.yimg.*/.* 720 80% 4320
      refresh_pattern ^http://*.plasa.com/.* 720 80% 4320
      refresh_pattern ^http://*.boleh.*/.* 720 80% 4320
      refresh_pattern ^http://*.detik.*/.* 180 80% 4320
      refresh_pattern ^http://*.detikinet.*/.* 180 80% 4320
      refresh_pattern ^http://*.detikhot.*/.* 180 80% 4320
      refresh_pattern ^http://*.detiportal.*/.* 180 80% 4320
      refresh_pattern ^http://*.kompas.*/.* 180 80% 4320
      refresh_pattern ^http://*.kapanlagi.*/.* 720 80% 4320
      refresh_pattern ^http://*.google-analytics.*/.* 720 80% 4320

      # add from KtheXBeleX

      refresh_pattern ^http://(.*?)/get_video\? 10080 90% 999999 override-expire ignore-no-cache ignore-private
      refresh_pattern ^http://(.*?)/videoplayback\? 10080 90% 999999 override-expire ignore-no-cache ignore-private
      refresh_pattern -i (get_video\?|videoplayback\?id|videoplayback.*id) 161280 50000% 525948 override-expire ignore-reload

      # my refresh_patern

      # compressed
      refresh_pattern -i \.gz$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.cab$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.bzip2$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.bz2$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.gz2$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.tgz$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.tar.gz$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.zip$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.rar$ 1008000 90% 99999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.tar$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.ace$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.7z$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload

      # documents
      refresh_pattern -i \.xls$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.doc$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.xlsx$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.docx$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.pdf$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.ppt$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.pptx$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.rtf\?$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload

      # multimedia
      refresh_pattern -i \.mid$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.wav$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.viv$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.mpg$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.mov$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.avi$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.asf$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.qt$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.rm$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.rmvb$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.mpeg$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.wmp$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.3gp$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.mp3$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.mp4$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload

      # web content
      refresh_pattern -i \.js$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.psf$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.html$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.htm$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.css$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.swf$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.js\?$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.css\?$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.xml$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload

      # images
      refresh_pattern -i \.gif$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.jpg$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.png$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.jpeg$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.bmp$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.psd$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.ad$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.gif\?$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.jpg\?$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.png\?$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.jpeg\?$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.psd\?$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload

      # application
      refresh_pattern -i \.deb$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.rpm$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.msi$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.exe$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.dmg$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload

      # misc
      refresh_pattern -i \.dat$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.qtm$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload

      # itunes
      refresh_pattern -i \.m4p$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload
      refresh_pattern -i \.mpa$ 10080 90% 999999 override-expire override-lastmod reload-into-ims ignore-reload

      refresh_pattern ^ftp: 1440 20% 10080
      refresh_pattern ^gopher: 1440 0% 1440

      refresh_pattern cgi-bin 0 0% 0
      refresh_pattern \? 0 20% 4320
      refresh_pattern . 0 20% 4320

      storeurl_access deny all

      ####### ADZAPER #######

      redirect_program C:/squid/bin/perl.exe C:/squid/adzap/scripts/squid_redirect
      redirect_children 5

      ### END OF ADZAPPER ###

      #################################################
      # Delaypools added by imer :shakehand #
      # default setting is disabled #
      # enable it by removing # mark at start of line #
      #################################################

      #acl time time SMTWHFA 09:00-23:59
      #acl host url_regex -i “C:/squid/etc/host.acl”
      #acl lambat url_regex -i “C:/squid/etc/lambat.acl”
      #acl download urlpath_regex -i “C:/squid/etc/download.acl”

      #delay_pools 3
      #delay_access 1 allow host
      #delay_access 1 deny all
      #delay_access 2 allow download time
      #delay_access 2 deny all
      #delay_access 3 allow lambat time
      #delay_access 3 deny all

      #delay_class 1 2
      #delay_class 2 2
      #delay_class 3 2

      #delay_parameters 1 -1/-1 -1/-1
      #delay_parameters 2 -1/-1 1000/100000
      #delay_parameters 3 -1/-1 1000/100000

      ################ END DELAYPOOLS ################

      http_access allow manager localhost
      http_access allow ym
      http_access allow localhost
      http_access allow localNet
      http_access deny manager
      http_access deny !Safe_ports
      http_access deny CONNECT !SSL_ports
      http_access deny all
      http_reply_access allow all
      icp_access allow all

      # YouTube options.
      quick_abort_min -1 KB

      # This will block other streaming media.Maybe we don’t want this, but using
      # it for now.
      # hierarchy_stoplist cgi-bin ?
      # acl QUERY urlpath_regex cgi-bin \?
      # cache deny QUERY
      cache allow all

      ## ANONYMITY OPTION ###
      #header_access From deny all
      #header_access Referer deny all
      #header_access Server deny all
      #header_access User-Agent deny all
      #header_access WWW-Authenticate deny all
      #header_access Link deny all

      header_access Proxy-Connection deny all
      header_access Cache-Control deny all
      header_access X-Cache deny all
      header_access X-Cache-Lookup deny all
      header_access X-Powered-By deny all
      header_access Via deny all
      # header_access Rewrite-URL deny all
      # header_access X-Rewrite-URL deny all
      header_access Forwarded-For deny all
      header_access X-Forwarder-For deny all
      # header_access Pragma deny all
      # header_access Keep-Alive deny all
      #### cendol donk gan ####

      # Squid port
      http_port 3128 transparent

      # Google earth caching
      # Define (sub)domain for Google map, earth/satellite, street views, and location images
      acl gmapserver url_regex mt[0-9]?.google.co(m|\.id)
      acl gmapserver url_regex khm[0-9]?.google.co(m|\.id)
      acl gmapserver url_regex kh[0-9]?.google.co(m|\.id)
      acl gmapserver url_regex cbk[0-9]?.google.co(m|\.id)
      acl gmapserver url_regex t[0-9]?.google.co(m|\.id)

      # Allow storeurl for gmapserver
      storeurl_access allow gmapserver
      storeurl_access deny all

      # Storeurl script
      storeurl_rewrite_program /etc/squid/gmaps.pl
      storeurl_rewrite_children 1
      storeurl_rewrite_concurrency 10

      # Recommended minimum configuration:
      acl all src all
      acl manager proto cache_object
      acl localhost src 127.0.0.1/32
      acl to_localhost dst 127.0.0.0/8

      # Internal network
      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

      # Safe ports
      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

      # Recommended minimum configuration:
      # Only allow cachemgr access from localhost
      http_access allow manager localhost
      http_access deny manager

      # Deny requests to unknown ports
      http_access deny !Safe_ports

      # Deny CONNECT to other than SSL ports
      http_access deny CONNECT !SSL_ports
      http_access allow localnet

      # And finally deny all other access to this proxy
      http_access deny all

      # Logging
      access_log /var/log/cache/logs/access.log squid

      # Refresh patterns
      refresh_pattern -i (mt|kh|khm|cbk|t).*\.google\.co(m|.id) 10080 90% 21600 override-expire reload-into-ims ignore-private ignore-must-revalidate
      refresh_pattern ^ftp: 1440 20% 10080
      refresh_pattern ^gopher: 1440 0% 1440
      refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
      refresh_pattern . 0 20% 4320

      # Don’t upgrade ShoutCast responses to HTTP
      acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
      upgrade_http0.9 deny shoutcast

      # Apache mod_gzip and mod_deflate known to be broken so don’t trust
      # Apache to signal ETag correctly on such responses
      acl apache rep_header Server ^Apache
      broken_vary_encoding allow apache

      # Leave coredumps in the first cache dir
      coredump_dir /var/log/cache/cache

      ——————————-

      btw udah bener blum gan? :bingungs

      untuk fle gmaps.pl ane cek sudah ada settingnya :
      #!/usr/bin/perl

      $| = 1;
      while () {
      @X = split;
      $x = $X[0] . ” “;
      # print STDERR $_ . “\n”;
      if (m/^http:\/\/(kh|mt|khm|cbk|t)[0-9]?(.google\.co(m|\.id).*)/) {
      print $x . “http://” . $1 . $2 . “\n”;
      } else {
      print $x . $X[1] . “\n”;
      }
      }

      ———————

      chmod +x /etc/squid/gmaps.pl << ditulis di command prompt yak? hasilnya kok cmod is not recognized as internal command bla3X :hammers:

      dan setelah diketik squid -k parse emang banyak error yang muncul, kira2 settingan ane salah dimana ya gan :(

      Reply
      1. fazar Post author

        wogh… squid NT ya.. (windows).. ya jelas nggak bisa masbro. kalo nggak salah squid NT versi terakhirnya 2.7.STABLE8 (mungkin ada banyak konfigurasi yg tidak kompatibel).

        posting di atas ditujukan untuk squid under UNI* (linux, bsd, dsb). kalo mau coba di squid NT, coba instal dulu strawberry perl. silakan google : strawberry perl.

        Reply

Tinggalkan Balasan

Alamat surel Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *