Visite também: Br-Linux ·  VivaOLinux ·  LinuxSecurity ·  Dicas-L ·  NoticiasLinux ·  SoftwareLivre.org ·  [mais]
Voltar   Under-Linux.org Fóruns > UnderLinux Wiki
Wiki Classificados Reviews Jogos Grupos Sociais RSS Feeds FAQ Termos de Uso Contato Sobre
Registrar Fotos Membros Calendário Pesquisar Postados Hoje Marcar Fóruns Como Lidos

Ferramentas pessoais
Publicidade

From UnderLinux Wiki

== Cache Youtube ==


Modulos do squid:

  1. ./configure –prefix=/usr –exec_prefix=/usr –bindir=/usr/sbin –sbindir=/usr/sbin –libexecdir=/usr/lib/squid –sysconfdir=/etc/squid –localstatedir=/var/spool/squid –datadir=/usr/share/squid –enable-linux-netfilter –enable-storeio=ufs,aufs,diskd,null –enable-arp-acl –enable-removal-policies=lru,heap –enable-snmp –enable-delay-pools –enable-htcp –enable-poll –enable-cache-digests –enable-underscores –enable-referer-log –enable-useragent-log –enable-auth=”basic,digest,ntlm” –enable-carp –enable-large-files


  • pearl tem que estar instalado!


Ja usei esta cache em ubuntu e Debian funcionou uma maravilha! Lembrando que o squid tem que estar na versão 2.7 stable3 ou 4 ou... . Vou postar primeiro meu squid.conf


                                    1. Squid.conf#################################



    1. PORT

http_port 8080 transparent

icp_port 3130

icp_query_timeout 0

mcast_icp_query_timeout 2000

dead_peer_timeout 10 seconds

  1. ============================================================$
  1. hierarchy_stoplist cgi-bin ?
  1. acl QUERY urlpath_regex cgi-bin \?
  1. cache deny QUERY
  1. ============================================================$
  1. ============================================================$
  1. LOGFILE PATHNAMES AND CACHE DIRECTORIES
  1. ============================================================$

cache_dir aufs /var/cache/squid/cache1/ 40000 16 256

cache_dir aufs /var/cache/squid/cache2/ 40000 16 256

cache_dir aufs /var/cache/squid/cache3/ 40000 16 256

cache_access_log /var/log/squid/access.log

cache_log /var/log/squid/cache.log

cache_store_log /var/log/squid/store.log

mime_table /etc/squid/mime.conf

pid_filename /var/run/squid.pid

log_fqdn off

log_mime_hdrs off

log_ip_on_direct off

logfile_rotate 7

debug_options ALL,1

buffered_logs off

emulate_httpd_log off

  1. ============================================================$
  1. FTP section
  1. ============================================================$

ftp_user anonymous@

ftp_list_width 32

ftp_passive on

ftp_sanitycheck on

  1. ============================================================$
  1. DNS resolution section
  1. ============================================================$
  1. cache_dns_program /squid/libexec/dnsserver
  1. dns_children 24
  1. dns_nameservers 202.134.1.10 202.134.2.5 202.134.0.155
  1. ============================================================$

quick_abort_min 0 KB

quick_abort_max 0 KB

quick_abort_pct 98

negative_ttl 3 minutes

positive_dns_ttl 53 seconds

negative_dns_ttl 29 seconds

forward_timeout 4 minutes

connect_timeout 2 minutes

peer_connect_timeout 1 minutes

pconn_timeout 120 seconds

shutdown_lifetime 10 seconds

read_timeout 15 minutes

request_timeout 5 minutes

persistent_request_timeout 1 minute

client_lifetime 60 minutes

half_closed_clients off

    1. ACL LIST NETWORK
  1. =================================================================$
  1. DIRECT IP/DOMAIN LOKAL
  1. ==================================================================$
  1. acl local-dst dst semuaalamatlokal semuaalamatipygdekat
  1. acl local-domain dstdomain localhost domain-anda.com isp-anda.com domainku.web.id
  1. always_direct allow localhost local-dst local-domain
  1. always_direct deny all
  1. ===================================================================$
  1. DEFAULT ACL
  1. ===================================================================$

acl all src 0.0.0.0/0.0.0.0

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 563 # https, snews

acl SSL_ports port 873 # rsync

acl Safe_ports port 80 # http

acl Safe_ports port 21 # ftp

acl Safe_ports port 443 563 # https, snews

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 Safe_ports port 631 # cups

acl Safe_ports port 873 # rsync

acl Safe_ports port 901 # SWAT

acl purge method PURGE

acl CONNECT method CONNECT

http_access allow manager localhost

http_access deny manager

http_access allow purge localhost

http_access deny purge

http_access deny !Safe_ports

http_access deny CONNECT !SSL_ports

http_access allow localhost

http_access deny all

http_reply_access allow all

icp_access allow all


  1. =============================================================$
    1. REDES QUE TERAO ACESSO
  1. =============================================================$
  1. Coloque aqui as redes validas

acl internet src 200.0.0.0/8

  1. Coloque aqui as redes invalidas

acl intranetac src 192.168.0.0/16 10.0.0.0/8

acl intranetb src 172.0.0.0/8

http_access allow localhost

http_access allow internet

http_access allow intranetac

http_access allow intranetb

  1. =============================================================$
    1. YOURTUBE + PhotoBucket CACHE
  1. =============================================================$

acl store_rewrite_list url_regex ^http://(.*?)/get_video\?

acl store_rewrite_list url_regex ^http://(.*?)/videodownload\?

acl store_rewrite_list url_regex ^http://i(.*?).photobucket.com/albums/(.*?)/(.*?)/(.*?)\?

acl store_rewrite_list url_regex ^http://vid(.*?).photobucket.com/albums/(.*?)/(.*?)\?

cache allow store_rewrite_list

cache allow all

storeurl_access allow store_rewrite_list

storeurl_access deny all

storeurl_rewrite_program /usr/local/bin/store_url_rewrite

  1. ============================================================$
  1. Parameter Administratif $
  1. ============================================================$

cache_mgr myauth.com.br

cache_effective_user proxy

cache_effective_group proxy

visible_hostname proxy.smol.comb.r

unique_hostname support@smol.com.br

  1. =============================================================$
  1. TRANSPARENT PROXY MODE 4 Ver 2.6
  1. =============================================================$

http_port 172.25.0.2:8080 transparent

  1. httpd_accel_no_pmtu_disc on
  1. half_closed_clients off
  1. header_access From deny all
  1. header_access Referer deny all
  1. header_access Server deny all
  1. header_access WWW-Authenticate deny all
  1. header_access Link deny all
  1. header_access Via deny all
  1. header_access X-Forwarded-For deny all
  1. header_access Accept-Encoding deny all
  1. header_access User-Agent deny all
  1. header_replace User-Agent Mozilla/5.0 (compatible; MSIE 6.0)
  1. header_access Accept deny all
  1. header_replace Accept */*
  1. header_access Accept-Language deny all
  1. header_replace Accept-Language id, en
  1. ============================================================$
  1. ACCELERATOR
  1. ============================================================$

memory_pools off

forwarded_for off

log_icp_queries off

icp_hit_stale on

minimum_direct_hops 4

minimum_direct_rtt 400

store_avg_object_size 13 KB

store_objects_per_bucket 20

client_db on

netdb_low 9900

netdb_high 10000

netdb_ping_period 30 seconds

query_icmp off

pipeline_prefetch on

reload_into_ims on

vary_ignore_expire on

max_open_disk_fds 100

nonhierarchical_direct on

prefer_direct off

  1. ============================================================$
  1. OPTIONS WHICH AFFECT THE CACHE SIZE
  1. ============================================================$

cache_mem 6 MB

maximum_object_size 250 MB

maximum_object_size_in_memory 32 KB

cache_swap_low 98%

cache_swap_high 99%

store_dir_select_algorithm round-robin

ipcache_size 2048

ipcache_low 98

ipcache_high 99

fqdncache_size 2048

cache_replacement_policy heap LFUDA

memory_replacement_policy heap GDSF

  1. ============================================================$
  1. SNMP
  1. ============================================================$

acl snmpcommunity snmp_community public

snmp_port 3401

snmp_access allow snmpcommunity localhost

snmp_access deny all

  1. =============================================================$
  1. Block Iklan menggunakan Adzapper
  1. =============================================================$
  1. url_rewrite_program /usr/bin/adzapper
  1. ============================================================$
  1. ZPH
  1. ============================================================$
  1. tcp_outgoing_tos 0×30 localnet

zph_mode tos

zph_local 0×30

zph_parent 0

zph_option 136

  1. ============================================================$
  1. Refresh Rate
  1. ============================================================$
  1. Youtube

refresh_pattern ^http://(.*?)/get_video\? 10080 90% 999999 override-expire ignore-no-cache ignore-private

refresh_pattern ^http://(.*?)/videodownload\? 10080 90% 999999 override-expire ignore-no-cache ignore-private

  1. Photo Bucket

refresh_pattern ^http://i(.*?).photobucket.com/albums/(.*?)/(.*?)/(.*?)\? 43200 90% 999999 override-expire ignore-no-cache ignore-private

refresh_pattern ^http://vid(.*?).photobucket.com/albums/(.*?)/(.*?)\? 43200 90% 999999 override-expire ignore-no-cache ignore-private

  1. =============================================================$
  1. image
  1. =============================================================$

refresh_pattern -i \.(swf|png|jpg|jpeg|bmp|tiff|png|gif) 43200 75% 129600 override-expire override-lastmod ignore-reload reload-into-ims

  1. =============================================================$
  1. dokumen
  1. =============================================================$

refresh_pattern -i \.(doc|xls|ppt|ods|odt|odp|pdf) 43200 75% 129600 override-expire override-lastmod ignore-reload reload-into-ims

  1. =============================================================$
  1. multimedia
  1. =============================================================$

refresh_pattern -i \.(mov|mpg|mpeg|flv|avi|mp3|3gp|sis|wma|3gp|mp4) 43200 75% 129600 override-expire override-lastmod ignore-reload reload-into-ims

  1. =============================================================$
  1. compression
  1. =============================================================$

refresh_pattern -i \.(zip|rar|ace|bz|bz2|tar|gz|exe|rpm|deb|bin|cab) 43200 75% 129600 override-expire override-lastmod ignore-reload reload-into-ims

  1. =============================================================$
  1. web default eks
  1. =============================================================$

refresh_pattern -i (.*html$|.*htm|.*shtml|.*aspx|.*asp|.*php) 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

  1. =============================================================$
  1. situs internet validasi 24 jam - lama penyimpanan 7 hari
  1. =============================================================$

refresh_pattern ^http://*.google.*/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.google.co.id/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.wordpress.com/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.youtube.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.blogger.com/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.wikipedia.*/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.facebook.*/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.wikimapia.*/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.astaga.*/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*korea.*/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.akamai.*/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.windowsmedia.*/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.googlesyndication.*/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.plasa.*/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.telkom.*/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.friendster.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.detiksport.com/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.kompas.com/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.detiknews.com/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.photobucket.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.detikhot.com/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.kapanlagi.com/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.okezone.com/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.indowebster.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.telkomspeedy.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.imagevenue.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.flickr.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.imageshack.us/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.usercash.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.googlesyndication.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.co.cc/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.21cineplex.com/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.saatchi-gallery.co.uk/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.onemanga.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.jobsdb.com/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.imeem.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.download.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.amazon.com/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.friendster-layouts.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.geocities.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.redtube.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.files.wordpress.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://indonetwork.co.id/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://gudanglagu.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://megaupload.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.karir.com/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.myspace.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.multiply.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.rapidshare.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.4shared.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.ziddu.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.kaskus.com/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.kaskus.us/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://www.friendster.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://mail.yahoo.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://login.yahoo.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://mail.yahoo.co.id/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://mail.google.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.yahoo.*/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.yahoo.com/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.yahoo.co.id/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.akamai.net/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.yimg.*/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.gmail.*/.* 180 100% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern ^http://*.detik.*/.* 180 35% 4320 override-expire override-lastmod ignore-reload reload-into-ims

refresh_pattern cgi-bin 0 0% 0

refresh_pattern \? 0 0% 0

refresh_pattern . 0 20% 4320

refresh_pattern ^gopher: 1440 0% 1440

refresh_pattern ^ftp: 129600 90% 259200 reload-into-ims override-expire


                                                                  1. FIM########################################



Criem este arquivo: "storeurl_rewrite_program" no diretorio: "/usr/local/bin/store_url_rewrite"


com o seguinte conteudo:


  1. !/usr/bin/perl

$|=1;

while (<>) {

@X = split;

$url = $X[0];

$url =~s@^http://(.*?)/get_video\?(.*)video_id=(.*?)&.*@squid://videos.youtube.INTERNAL/ID=$3@;

$url =~s@^http://(.*?)/get_video\?(.*)video_id=(.*?)$@squid://videos.youtube.INTERNAL/ID=$3@;

$url =~s@^http://(.*?)/videodownload\?(.*)docid=(.*?)$@squid://videos.google.INTERNAL/ID=$3@;

$url =~s@^http://(.*?)/videodownload\?(.*)docid=(.*?)&.*@squid://videos.google.INTERNAL/ID=$3@;

$url =~s@^http://(.*?)/albums\?&.*@squid://images.photobucket.INTERNAL/ID=$3@;

$url =~s@^http://(.*?)/albums\?$@squid://images.photobucket.INTERNAL/ID=$3@;

$url =~s@^http://(.*?)/albums\?&.*@squid://videos.photobucket.INTERNAL/ID=$3@;

$url =~s@^http://(.*?)/albums\?$@squid://videos.photobucket.INTERNAL/ID=$3@;

print "$url\n"; }



É isto aí Pessoal, o cache do Youtube ta aí!

Horários baseados na GMT -3. Agora são 11:18.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Powered by vbWiki Pro 1.3 RC5. Copyright ©2006-2007, NuHit, LLC
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.