[./Halaman]

Jumat, 31 Agustus 2012

Update Squid.conf 31/Aug/2012

# SQUID 2.7.STABLE7
# -----------------

# By : Angga Adi
# E-mail : dittaanggas7@gmail.com
# Blog : http://be2x-opensource.blogspot.com/

# ACCESS CONTROLS
# -----------------------------------------------------------------------------
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 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 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
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 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
# ACL GET cache
acl getmethod method GET
# ACL untuk cache video
acl store_rewrite_list urlpath_regex \/(get_video|video\?v|videoplayback\?id|videoplayback.*id)
acl store_rewrite_list urlpath_regex \/(get_video\?|videodownload\?|videoplayback.*id|watch\?)
acl dontrewrite url_regex (get_video|video\?v=|videoplayback\?id|videoplayback.*id).*begin\=[1-9][0-9]* \.php\? \.asp\? \.aspx\? threadless.*\.jpg\?r=
# ACL untuk cache semua tipe file
acl store_rewrite_list urlpath_regex \.(3gp|mp(3|4)|flv|(m|f)4v|on2|fid|avi|mov|wm(a|v)|(mp(e?g|a|e|1|2))|mk(a|v)|jp(e?g|e|2)|gif|png|tiff?|bmp|tga|svg|ico|swf|exe|ms(i|u|p)|cab|psf|mar|bin|z(ip|[0-9]{2})|r(ar|[0-9]{2})|7z)\?
acl store_rewrite_list_path urlpath_regex \.(3gp|mp(3|4)|flv|(m|f)4v|on2|fid|avi|mov|wm(a|v)|(mp(e?g|a|e|1|2))|mk(a|v)|jp(e?g|e|2)|gif|png|tiff?|bmp|tga|svg|ico|swf|exe|ms(i|u|p)|cab|psf|mar|bin|z(ip|[0-9]{2})|r(ar|[0-9]{2})|7z)$
# ACL
acl store_rewrite_list_domain url_regex ^http:\/\/(([a-z-]+[0-9-]+)|([0-9-]+[a-z-]+))\.[a-z0-9-]*\.[a-z]{2,4}
acl store_rewrite_list_domain url_regex ^http:\/\/([a-zA-Z-]+[0-9-]+)\.[A-Za-z]*\.[A-Za-z]*
acl store_rewrite_list_domain url_regex (([a-z]{1,2}[0-9]{1,3})|([0-9]{1,3}[a-z]{1,2}))\.[a-z]*[0-9]?\.[a-z]{3}
# ACL untuk *.speedtest.*
acl store_rewrite_list_domain_CDN url_regex ^http:\/\/.*speedtest.*
acl speedtest_allow_dom dstdomain .speedtest.net
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access allow SSL_ports
http_access allow Safe_ports
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow to_localhost
http_access allow localnet
http_access allow localhost
http_access deny all
http_reply_access allow all
reply_body_max_size 0 allow all

# OPTIONS FOR X-Forwarded-For
# -----------------------------------------------------------------------------
follow_x_forwarded_for deny all

# NETWORK OPTIONS
# -----------------------------------------------------------------------------
http_port 127.0.0.1:3128
tcp_outgoing_tos 0x04 localhost
tcp_outgoing_tos 0x04 localnet
tcp_outgoing_tos 0x04 to_localhost
zph_mode tos
zph_local 0x04
zph_parent 0x04
zph_option 136

# OPTIONS WHICH AFFECT THE NEIGHBOR SELECTION ALGORITHM
# -----------------------------------------------------------------------------
cache_peer 127.0.0.1 parent 3128 0 no-query no-digest no-netdb-exchange default
cache_peer_access 127.0.0.1 allow all
hierarchy_stoplist cgi-bin ?

# MEMORY CACHE OPTIONS
# -----------------------------------------------------------------------------
cache_mem 8 MB
maximum_object_size_in_memory 8 KB
memory_replacement_policy heap GDSF

# DISK CACHE OPTIONS
# -----------------------------------------------------------------------------
cache_replacement_policy heap LFUDA
#cache_dir aufs /var/spool/squid 11000 26 256
cache_dir aufs /media/cache1 11000 26 256
cache_dir aufs /media/cache2 11000 26 256
cache_dir aufs /media/cache3 11000 26 256
store_dir_select_algorithm least-load
max_open_disk_fds 0
minimum_object_size 0 KB
maximum_object_size 32 MB
cache_swap_low 90
cache_swap_high 95
update_headers on

# LOGFILE OPTIONS
# -----------------------------------------------------------------------------
access_log /var/log/squid/access.log squid
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
logfile_rotate 0
mime_table /usr/share/squid/mime.conf
pid_filename /var/run/squid.pid

# OPTIONS FOR URL REWRITING
# -----------------------------------------------------------------------------
storeurl_rewrite_program /etc/squid/storeurl.pl
storeurl_rewrite_children 4
storeurl_rewrite_concurrency 10
storeurl_access allow store_rewrite_list
storeurl_access allow store_rewrite_list_domain

# OPTIONS FOR TUNING THE CACHE
# -----------------------------------------------------------------------------
#cache deny DENYCACHE
max_stale 1 week
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Package(.gz)*)$ 0 20% 2880
refresh_pattern -i (cgi-bin) 0 0% 0
refresh_pattern . 0 20% 4320
quick_abort_min 0 KB
quick_abort_max 0 KB
quick_abort_pct 90
read_ahead_gap 16 KB
negative_ttl 5 minutes
store_avg_object_size 13 KB

# HTTP OPTIONS
# -----------------------------------------------------------------------------
request_header_max_size 20 KB
reply_header_max_size 20 KB
request_bodx_max_size 0 allow all
via on
header_access Via deny all
header_access Forwarded-For deny all
header_access X-Forwarded-For deny all
header_access Server deny all
header_access Referer deny all
header_access User-Agent deny all
header_replace User-Agent anonymous
server_http11 on

# ADMINISTRATIVE PARAMETERS
# -----------------------------------------------------------------------------
cache_mgr dittaanggas7@gmail.com
cache_effective_user proxy
cache_effective_group proxy
visible_hostname h4ck3r-proxy-server
unique_hostname h4ck3r-proxy-server

# DELAY POOL PARAMETERS
# -----------------------------------------------------------------------------

# PERSISTENT CONNECTION HANDLING
# -----------------------------------------------------------------------------

# CACHE DIGEST OPTIONS
# -----------------------------------------------------------------------------
digest_generation on
digest_bits_per_entry 5
digest_rebuild_period 1 hour
digest_rewrite_period 1 hour
digest_swapout_chunk_size 4096 bytes
digest_rebuild_chunk_percentage 10

# OPTIONS INFLUENCING REQUEST FORWARDING
# -----------------------------------------------------------------------------
nonhierarchical_direct on
prefer_direct off
ignore_ims_on_miss off
always_direct allow localhost
always_direct allow localnet
always_direct allow to_localhost
never_direct allow all

# ADVANCED NETWORKING OPTIONS
# -----------------------------------------------------------------------------
max_filedescriptors 0
tcp_recv_bufsize 0 bytes

# DNS OPTIONS
# -----------------------------------------------------------------------------
dns_nameservers 127.0.0.1 8.8.8.8 8.8.4.4
hosts_file /etc/hosts
ipcache_size 1024
ipcache_low 95
ipcache_high 99
fqdncache_size 1024

# MISCELLANEOUS
# -----------------------------------------------------------------------------
forwarded_for off
reload_into_ims on
coredump_dir /var/spool/squid
balance_on_multiple_ip on
pipeline_prefetch on