# cat /etc/squid/squid.conf
########### Port Config:
http_port 127.0.0.1:3128 
http_port 192.168.24.26:3128 transparent
icp_port 3130

########### WCCP2 Config:
wccp2_router 192.168.24.25
wccp2_address 192.168.24.26
wccp2_forwarding_method 1
wccp2_return_method 1
wccp2_service standard 0 password=123_cp

########### Performance Related Config:
hierarchy_stoplist cgi-bin ?
forwarded_for on
half_closed_clients off
persistent_request_timeout 2 minutes
max_filedescriptors 65536
max_open_disk_fds 65536
relaxed_header_parser on
reload_into_ims on
quick_abort_min 0 KB
quick_abort_max 0 KB
client_lifetime 15 minutes
read_timeout 5 minutes
request_timeout 1 minutes
extension_methods NICK
ie_refresh on
ignore_expect_100 on
vary_ignore_expire on

cache_mem 6 MB
maximum_object_size_in_memory 32 KB
memory_replacement_policy heap GDSF
cache_replacement_policy heap LFUDA

ipcache_size 2048
ipcache_low 98
ipcache_high 99
memory_pools off
pipeline_prefetch on

httpd_accel_no_pmtu_disc on
httpd_suppress_version_string on

########### Cache Config:
cache_dir aufs /cache1 180000 32 256
cache_dir aufs /cache2 180000 32 256
cache_dir aufs /cache3 180000 32 256
cache_effective_user squid
cache_effective_group squid
cache_swap_low 98
cache_swap_high 99
cache_replacement_policy heap LFUDA
request_header_max_size 2048 KB
minimum_object_size 512 bytes
maximum_object_size 5 GB
negative_ttl 0 seconds
negative_dns_ttl 1 second

########### ACL Config:

acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl cachehost src 192.168.24.26
acl to_cachehost dst 192.168.24.26

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 localnet src 192.168.24.0/255.255.248.0 172.18.80.0/255.255.240.0

http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access allow localhost
###
http_access allow cachehost
http_access deny to_cachehost
http_access allow localnet
###
http_access deny all
icp_access deny all

acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
coredump_dir /var/log/squid
error_directory /etc/squid/errors/English
cache_store_log none
pid_filename /var/run/squid.pid
log_fqdn off
log_icp_queries off
logfile_rotate 1

### Caching Videos: YouTube, Google, and others:
acl store_rewrite_list urlpath_regex \/(get_video\?|videodownload\?|videoplayback.*id)
acl store_rewrite_list urlpath_regex \/ads\?
acl store_rewrite_list urlpath_regex \.(mp2|mp3|mid|midi|mp[234]|wav|ram|ra|rm|au|3gp|m4r|m4a)\?
acl store_rewrite_list urlpath_regex \.(mpg|mpeg|mp4|m4v|mov|avi|asf|wmv|wma|dat|flv|swf)\?
acl store_rewrite_list urlpath_regex \.(jpeg|jpg|jpe|jp2|gif|tiff?|pcx|png|bmp|pic|ico)\? 

acl store_rewrite_list_web url_regex ^http:\/\/([A-Za-z-]+[0-9]+)*\.[A-Za-z]*\.[A-Za-z]*
acl store_rewrite_list_web_CDN url_regex ^http:\/\/[a-z]+[0-9]\.google\.com doubleclick\.net

acl store_rewrite_list_path urlpath_regex \.(mp2|mp3|mid|midi|mp[234]|wav|ram|ra|rm|au|3gp|m4r|m4a)$
acl store_rewrite_list_path urlpath_regex \.(mpg|mpeg|mp4|m4v|mov|avi|asf|wmv|wma|dat|flv|swf)$
acl store_rewrite_list_path urlpath_regex \.(jpeg|jpg|jpe|jp2|gif|tiff?|pcx|png|bmp|pic|ico)$

#this is not related to youtube video its only for CDN pictures
storeurl_access allow store_rewrite_list_web_CDN
storeurl_access allow store_rewrite_list_web store_rewrite_list_path

storeurl_access allow store_rewrite_list
storeurl_access deny all
storeurl_rewrite_program /etc/squid/storeurl.pl
storeurl_rewrite_children 2
storeurl_rewrite_concurrency 10

########### Refresh_pattern Config:
#for YouTube and Google:
refresh_pattern -i (get_video\?|videoplayback\?|videodownload\?) 5259487 999% 5259487 override-expire ignore-reload reload-into-ims ignore-no-cache ignore-private

#for the music:
refresh_pattern -i \.(mp2|mp3|mid|midi|mp[234]|wav|ram|ra|rm|au|3gp|m4r|m4a)(\?.*|$) 5259487 999% 5259487 override-expire ignore-reload reload-into-ims ignore-no-cache ignore-private

#for the movies:
refresh_pattern -i \.(mpg|mpeg|mp4|m4v|mov|avi|asf|wmv|wma|dat|flv|swf)(\?.*|$) 5259487 999% 5259487 override-expire ignore-reload reload-into-ims ignore-no-cache ignore-private

#for pictures:
refresh_pattern -i \.(jpeg|jpg|jpe|jp2|gif|tiff?|pcx|png|bmp|pic|ico)(\?.*|$) 5259487 999% 5259487 override-expire ignore-reload reload-into-ims ignore-no-cache ignore-private

#for MS docs:
refresh_pattern -i \.(chm|dll|doc|docx|xls|xlsx|ppt|pptx|pps|ppsx|mdb|mdbx)(\?.*|$) 5259487 999% 5259487 override-expire ignore-reload reload-into-ims ignore-no-cache ignore-private

#for various other docs:
refresh_pattern -i \.(txt|conf|cfm|psd|wmf|emf|vsd|pdf|rtf|odt)(\?.*|$) 5259487 999% 5259487 override-expire ignore-reload reload-into-ims ignore-no-cache ignore-private

#for the well-known compressed/excutable files:
refresh_pattern -i \.(class|jar|exe|gz|bz|bz2|tar|tgz|zip|gzip|arj|ace|bin|cab|msi|rar)(\?.*|$) 5259487 999% 5259487 override-expire ignore-reload reload-into-ims ignore-no-cache ignore-private

#for various client-side Web docs:
refresh_pattern -i \.(htm|html|mhtml|css|js)(\?.*|$) 1440 90% 86400 override-expire ignore-reload reload-into-ims

refresh_pattern -i (/cgi-bin/|\?) 	0	0%	0
refresh_pattern .			0	20%	4320


