Advertisement
pakdoz

Squid.conf Youtube Caching

Aug 29th, 2013
6,007
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 3.22 KB | None | 0 0
  1. # Squid.conf untuk Youtube Caching
  2. # Web  : http://www.tuts.web.id
  3.  
  4. http_port 8080 transparent
  5. server_http11 on
  6. icp_port 0
  7.  
  8. # Ukuran cache saya set 5 GB dan folder cache di /cache, silahkan ganti sesuai kebutuhan anda
  9. store_dir_select_algorithm round-robin
  10. cache_dir aufs /cache 5000 16 256
  11. cache_replacement_policy heap LFUDA
  12. memory_replacement_policy heap LFUDA
  13.  
  14. # Format log squid
  15. emulate_httpd_log on
  16. logformat squid %tl %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
  17. log_fqdn off
  18.  
  19. # Berapa hari file log akan tersimpan? saya set disini 2 hari.
  20. # Anda bisa melakukan rotasi file log secara berkala dengan cron. Contoh:
  21. # 0 0 * * * /usr/local/squid/bin/squid -k rotate
  22. logfile_rotate 2
  23. debug_options ALL,1
  24. cache_access_log /var/log/squid/access.log
  25. cache_log /var/log/squid/cache.log
  26. cache_store_log /var/log/squid/store.log
  27.  
  28. #192.168.0.155 adalah Unbound DNS Server milik saya, berfungsi agar mempercepat query DNS
  29. #Jika anda tidak memiliki local dns server, isi dengan DNS server seperti Google DNS, yakni 8.8.8.8
  30. dns_nameservers 192.168.0.155
  31.  
  32. #Access Control List
  33. acl all src 0.0.0.0/0.0.0.0
  34. acl manager proto cache_object
  35. acl localhost src 127.0.0.1/255.255.255.255
  36. acl to_localhost dst 127.0.0.0/8
  37. acl SSL_ports port 443 563 # https, snews
  38. acl SSL_ports port 873 # rsync
  39. acl Safe_ports port 80 # http
  40. acl Safe_ports port 21 # ftp
  41. acl Safe_ports port 443 563 # https, snews
  42. acl Safe_ports port 70 # gopher
  43. acl Safe_ports port 210 # wais
  44. acl Safe_ports port 1025-65535 # unregistered ports
  45. acl Safe_ports port 280 # http-mgmt
  46. acl Safe_ports port 488 # gss-http
  47. acl Safe_ports port 591 # filemaker
  48. acl Safe_ports port 777 # multiling http
  49. acl Safe_ports port 631 # cups
  50. acl Safe_ports port 873 # rsync
  51. acl Safe_ports port 901 # SWAT
  52. acl purge method PURGE
  53. acl CONNECT method CONNECT
  54. http_access allow manager localhost
  55. http_access deny manager
  56. http_access allow purge localhost
  57. http_access deny purge
  58. http_access deny !Safe_ports
  59. http_access deny CONNECT !SSL_ports
  60. http_access allow localhost
  61. http_access allow all
  62. http_reply_access allow all
  63. icp_access allow all
  64.  
  65. cache_effective_user proxy
  66. cache_effective_group proxy
  67. cache_mgr anda@email.com
  68. visible_hostname proxy.tuts.web.id
  69. unique_hostname anda@email.com
  70.  
  71. cache_mem 8 MB
  72. minimum_object_size 0 bytes
  73. maximum_object_size 100 MB
  74. maximum_object_size_in_memory 128 KB
  75.  
  76. refresh_pattern ^ftp: 1440 20% 10080
  77. refresh_pattern ^gopher: 1440 0% 1440
  78. refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
  79. refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880
  80. refresh_pattern . 0 50% 4320
  81. acl apache rep_header Server ^Apache
  82. broken_vary_encoding allow apache
  83.  
  84. # Rules untuk caching video YouTube
  85. url_rewrite_program /etc/nginx/nginx.rb
  86. url_rewrite_host_header off
  87. acl youtube_videos url_regex -i ^http://[^/]+\.youtube\.com/videoplayback\?
  88. acl range_request req_header Range .
  89. acl begin_param url_regex -i [?&]begin=
  90. acl id_param url_regex -i [?&]id=
  91. acl itag_param url_regex -i [?&]itag=
  92. acl sver3_param url_regex -i [?&]sver=3
  93. cache_peer 127.0.0.1 parent 8081 0 proxy-only no-query connect-timeout=10
  94. cache_peer_access 127.0.0.1 allow youtube_videos id_param itag_param sver3_param !begin_param !range_request
  95. cache_peer_access 127.0.0.1 deny all
  96. #end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement