refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i naizhao.com 240 100% 1440 ignore-reload
refresh_pattern -i www.naizhao.com 240 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 . 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 .naizhao.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 silence.z@gmail.com
cache_effective_user nobody
cache_effective_group nobody
visible_hostname cnc.naizhao.com
logfile_rotate 0
always_direct allow all
error_directory /usr/local/squid/share/errors/Simplify_Chinese
coredump_dir /var/spool/squid
需要说明的几个参数:
cache_mem 1024 MB (squid使用的内存大小,注意必须要留下500M左右的内存给系统使用,建议系统内存2G,然后分配1G给squid)
cache_dir ufs /var/spool/squid 20480 16 256 (缓存的目录,放在/var/spool/squid下面,大小是20G,第一级目录是16个,第二级目录是256个。因为一个目录下面放置的文件和目录数量有限制,所以这里必须要设置多个目录,以适合squid存放大量文件的需要。目录数千万别设置太大,否则会引起系统死机)
memory_pools_limit 50 MB (内存池,用来存放缓存文件的链表,方便高速查找文件存放的对应位置,不需要太大。不懂就别管了)
cache_log /var/log/squid/cache.log(log文件的存放位置,必须要有读写权限,稍后说到)
refresh_pattern -i naizhao.com 240 100% 1440 ignore-reload








