Squid 2.7 conf for Windows

http_port 80 accel vhost vport

#源IP 等
cache_peer 218.1.72.225 parent 80 0 no-query round-robin max-conn=32 originserver name=dl
#需要加速的域名
cache_peer_domain dl dl.example.com  
#acl
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
#squid3.0无需此行
acl all src 0.0.0.0/0.0.0.0
acl SSL_ports port 443 563
acl Safe_ports port 80       # http
acl Safe_ports port 8080
acl LanDstDM dstdomain dl.example.com 
acl LanSrc src 192.168.0.0/24
acl LanDst dst 192.168.0.0/24

acl CONNECT method CONNECT
http_access allow manager localhost
http_access allow LanDstDM
http_access allow LanSrc
http_access allow LanDst
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny all

#base
visible_hostname dl.example.com 

cache_mgr cache@xxx.org
cache_effective_user squid
cache_effective_group squid

error_directory c:/squid/share/errors/Simplify_Chinese
icon_directory c:/squid/share/icons
mime_table c:/squid/etc/mime.conf

cache_replacement_policy lru
#cache_dir
cache_dir ufs c:/squid/var/cache 10000 16 64

cache_mem 64 MB

max_open_disk_fds 0
maximum_object_size 200 MB
maximum_object_size_in_memory 128 KB
#keepalived
client_persistent_connections off
server_persistent_connections on
#persistent_request_timeout 60 seconds

memory_pools on
memory_pools_limit 64 MB

forwarded_for on
log_icp_queries off

via on
httpd_suppress_version_string off

ie_refresh off
tcp_recv_bufsize 32 KB

#acl webservices rep_header Server -i ^Apache ^nginx
#broken_vary_encoding allow webservices

#hidden the squid header
#reply_header_access Server deny all
#reply_header_access X-Cache deny all
#reply_header_access Warning deny all
#reply_header_access Expires deny all
#reply_header_access Cache-Control deny all
#reply_header_access age deny all

#reply_header_access All deny all

ipcache_size 1024
ipcache_low 90
ipcache_high 95

memory_replacement_policy lru

hosts_file /etc/hosts
request_header_max_size 128 KB
#deny cache
hierarchy_stoplist cgi-bin ? \.php
acl QUERY urlpath_regex cgi-bin\? \.php \.css
acl DIRECT url_regex -i ^http:\/\/www\.yourdomain\.org\/$
acl DIRECT url_regex -i ^http:\/\/photo\.yourdomain \.org\/.*$
acl DIRECT url_regex -i ^http:\/\/www\.yourdomain \.org\/index\.html$

cache deny QUERY
cache deny DIRECT
#request_body_max_size 0 KB

refresh_pattern ^ftp: 60 20% 10080
refresh_pattern ^gopher: 60 0% 1440
refresh_pattern -i \.css$ 1440 50% 129600 reload-into-ims
refresh_pattern -i \.xml$ 1440 50% 129600 reload-into-ims
refresh_pattern -i \.html$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.shtml$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.htm$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.jpg$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.png$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.gif$ 1440 90% 129600 ignore-reload
refresh_pattern -i \.bmp$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.js$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.mp3$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.wmv$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.rm$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.swf$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.mpeg$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.wma$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.rar$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.zip$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.7z$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.pdf$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.exe$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.doc$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.txt$ 1440 50% 2880 ignore-reload
refresh_pattern . 120 50% 1440

#大文件缓存
quick_abort_min 16 MB
quick_abort_max 16 MB
quick_abort_pct 60

#下载工具
range_offset_limit -1

connect_timeout 1 minute
negative_ttl 0 minutes
read_timeout 30 seconds
pconn_timeout 120 seconds
shutdown_lifetime 5 seconds
strip_query_terms off

# snmp
#snmp_port 3401
#acl snmppublic snmp_community snsimg
#snmp_access allow snmppublic localhost
#snmp_access deny all

acl snmppublic snmp_community public
snmp_port 3401
snmp_access allow snmppublic all

icp_port 0

# logfile
emulate_httpd_log on
logformat orgbined %{X-Forwarded-For}>h %ui %un [%tl] “%rm %ru HTTP/%rv” %Hs %<st “%{Referer}>h” “%{User-Agent}>h” %Ss:%Sh

access_log c:/squid/var/logs/access.log squid   

cache_log c:/squid/var/logs/cache.log
pid_filename c:/squid/var/logs/squid.pid
cache_store_log none
logfile_rotate 12

# MISCELLANEOUS
store_objects_per_bucket 15
client_db off

添加了一些注释,简单的修改后直接就能使用。该版本,2.6和3.0都可以使用(3.0需要简单修改),有什么问题可以在下面留言,大家共同讨论。

Squid 2.7 for Windows 下载地址:http://www.serassio.it/SquidNT.htm

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据