./configure --prefix=/usr/local/squid --enable-follow-x-forwarded-for --enable-storeio=aufs,ufs --with-maxfd=65536 --with-pthreads --enable-dlmalloc --enable-poll --enable-stacktraces --enable-removal-policies=heap,lru --enable-delay-pools
make
makeinstall
cache_effective_user nobody
cache_effective_group nobody
http_port 80 vhost vport=80
#设定端口为80
acl apache rep_header Server ^Apache
#
broken_vary_encoding allow apache
cache_mem 2048 MB
#使用内存大小
maximum_object_size 409600 KB
#超过此文件大小的对象将不缓存
minimum_object_size 0 KB
#小于此大小文件将不被缓存
maximum_object_size_in_memory 512 KB
#内存中能缓存的最大文件大小
cache_dir ufs /var/spool/squid 20480 16 256
#缓存目录设置
cache_swap_low 80
#当交换分区利用率到这个百分比,那么开始替换
cache_swap_high 97
#当交换分区利用率到这个百分比,开始大量替换
strip_query_terms off
request_header_max_size 10 kb
request_body_max_size 0 kb
#设置HTTP请求的包头和数据大小
memory_pools on
memory_pools_limit 150 MB
#用来存放请求URL的内存大小
access_log none
cache_log /var/log/squid/cache.log
cache_store_log none
pid_filename /var/run/squid.pid
hosts_file /etc/hosts
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i www\.babidou\.com 1440 100% 1440 ignore-reload
refresh_pattern -i babidou\.com 1440 100% 1440 ignore-reload
refresh_pattern -i .gif 180 20% 10080 override-expire ignore-reload reload-into-ims
refresh_pattern -i .jpg 180 20% 10080 override-expire ignore-reload reload-into-ims
refresh_pattern -i .rar 180 20% 10080 override-expire ignore-reload reload-into-ims
refresh_pattern -i .html 180 20% 10080 override-expire ignore-reload reload-into-ims
refresh_pattern -i .swf 180 20% 10080 override-expire ignore-reload reload-into-ims
refresh_pattern -i .png 180 20% 10080 override-expire ignore-reload reload-into-ims
refresh_pattern -i .bmp 180 20% 10080 override-expire ignore-reload reload-into-ims
refresh_pattern . 120 50% 1440
acl all src 0.0.0.0/0.0.0.0
acl p-manager proto cache_object
acl s-localhost src 127.0.0.1/255.255.255.255
acl d-localhost dst 127.0.0.0/8
acl d-domains dstdomain .babidou.com
#允许访问的域名列表
acl p-ssl port 443 563
acl p-safe port 80 443 563
acl m-conn method CONNECT
acl m-purge method PURGE
acl n-maxconn maxconn 15
http_access allow p-manager s-localhost
http_access allow m-purge
http_access deny !p-safe
http_access deny m-conn !p-ssl
http_access deny n-maxconn
http_access allow p-manager
http_access allow d-domains
http_access deny all
http_reply_access allow all
acl r-url urlpath_regex realtime
cache deny r-url
icp_access allow all
follow_x_forwarded_for allow all
acl_uses_indirect_client offrange_offset_limit -1
dns_timeout 2 seconds
forward_timeout 10 seconds
connect_timeout 10 seconds
peer_connect_timeout 6 seconds
read_timeout 10 seconds
request_timeout 6 seconds
persistent_request_timeout 16 seconds
cache_mgr admin_@babidou.com
cache_effective_user nobody
cache_effective_group nobody
visible_hostname up18.babidou.com
logfile_rotate 0
always_direct allow all
error_directory /usr/local/squid/share/errors/Simplify_Chinese
coredump_dir /var/spool/squid
delay_pools 1
#定义一个池
delay_class 1 1
#池为1类型
delay_access 1 allow all
#允许类型1的所有请求访问
delay_parameters 1 128000/128000
#限制访问的128k/s
delay_initial_bucket_level 50
#Squid启动时,初始化池所用的带宽数量。