Skip to content

Instantly share code, notes, and snippets.

@MLWALK3R
Created December 22, 2014 05:24
Show Gist options
  • Save MLWALK3R/b0cb1e2661f259087eac to your computer and use it in GitHub Desktop.
Save MLWALK3R/b0cb1e2661f259087eac to your computer and use it in GitHub Desktop.
Squid Config 25/01/14 --15:00
acl QUERY urlpath_regex -i cgi-bin \? \.php$ \.asp$ \.shtml$ \.cfm$ \.cfml$ \.phtml$ \.php3$ localhost
http_port 3128
acl all src all
acl lan src 172.16.0.0/16
http_access allow lan
acl safeports port 21 70 80 210 280 443 488 563 591 631 777 901 81 3128 1025-65535
acl sslports port 443 563 81 2087 10000
acl purge method PURGE
acl connect method CONNECT
acl ad-block url_regex -i "/etc/squid3/ad_block.txt"
http_access deny ad-block
deny_info TCP_RESET ads
acl localnet dst 172.16.0.0/16
cache deny localnet
acl NO-CACHE-SITES dstdomain "/etc/squid3/not-to-cache-sites.txt"
no_cache deny NO-CACHE-SITES
cache deny NO-CACHE-SITES
acl m4s url_regex .m4s$
cache deny m4s
no_cache deny m4s
acl PURGE method PURGE
acl localhost src 127.0.0.1
http_access allow PURGE localhost
http_access deny PURGE
#
# NETWORK OPTIONS
# —————
#
http_port 3128 transparent
#
# OPTIONS WHICH AFFECT THE CACHE SIZE
# ==============================
#
cache_mem 1024 MB
maximum_object_size_in_memory 1024 KB
memory_replacement_policy heap GDSF
cache_replacement_policy heap LFUDA
cache_dir ufs /var/spool/squid 10000 14 256
maximum_object_size 128000 KB
cache_swap_low 95
cache_swap_high 99
#
# LOGFILE PATHNAMES AND CACHE DIRECTORIES
# ==================================
#
access_log /var/log/squid3/access.log
cache_log /cache/cache.log
#cache_log /dev/null
cache_store_log none
logfile_rotate 5
log_icp_queries off
#
# OPTIONS FOR TUNING THE CACHE
# ========================
#
refresh_pattern ^ftp: 1440 20% 10080 reload-into-ims
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i \.(gif|png|jp?g|ico|bmp|tiff?)$ 10080 95% 43200 override-expire override-lastmod reload-into-ims ignore-no-cache ignore-private
refresh_pattern -i \.(rpm|cab|deb|exe|msi|msu|zip|tar|xz|bz|bz2|lzma|gz|tgz|rar|bin|7z|doc?|xls?|ppt?|pdf|nth|psd|sis)$ 10080 90% 43200 override-expire override-lastmod reload-into-ims ignore-no-cache ignore-private
refresh_pattern -i \.(avi|iso|wav|mid|mp?|mpeg|mov|3gp|wm?|swf|flv|x-flv|axd)$ 43200 95% 432000 override-expire override-lastmod reload-into-ims ignore-no-cache ignore-private
refresh_pattern -i \.(html|htm|css|js)$ 1440 75% 40320
refresh_pattern -i \.index.(html|htm)$ 0 75% 10080
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 1440 90% 10080
cache deny QUERY
cache allow all
#
quick_abort_min 0 KB
quick_abort_max 0 KB
quick_abort_pct 100
store_avg_object_size 13 KB
#
# HTTP OPTIONS
# ===========
vary_ignore_expire on
#
# ANONIMITY OPTIONS
# ===============
#
request_header_access From deny all
request_header_access Server deny all
request_header_access Link deny all
request_header_access Via deny all
request_header_access X-Forwarded-For deny all
#
# TIMEOUTS
# =======
#
forward_timeout 240 second
connect_timeout 30 second
peer_connect_timeout 5 second
read_timeout 600 second
request_timeout 60 second
shutdown_lifetime 10 second
#
# ADMINISTRATIVE PARAMETERS
# =====================
#
cache_mgr ninja
cache_effective_user proxy
cache_effective_group proxy
httpd_suppress_version_string on
visible_hostname ninja
#
#
# DNS OPTIONS
# ==========
#
dns_timeout 5 seconds
dns_nameservers 127.0.0.1 172.16.0.3 # DNS Server
#
# MISCELLANEOUS
# ===========
#
memory_pools off
client_db off
reload_into_ims on
coredump_dir /cache
pipeline_prefetch on
offline_mode off
#
## disable ads ( http://pgl.yoyo.org/adservers/ )
#acl ads dstdom_regex "/etc/squid3/ad_block.txt"
#http_access deny ads
#deny_info TCP_RESET ads
### END CONFIGURATION ###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment