tar -zxvf squid-2.7.STABLE9.tar.gz
--prefix=/usr/local/squid \
--disable-internal-dns \
--enable-forward-log \
--enable-follow-x-forwarded-for \
--enable-snmp \
--enable-linux-netfilter \
--enable-http-violations \
--enable-delay-pools \
--enable-storeio=diskd,aufs,ufs,coss \
--with-coss-membuf-size=8388608 \
--with-large-files \
--enable-large-cache-files \
--with-maxfd=8192 \
--enable-removal-policies=lru,heap \
--enable-useragent-log \
--enable-referer-log \
--enable-err-languages=Simplify_Chinese \
--enable-default-err-language=Simplify_Chinese
chown -R nobody.nobody /usr/local/squid/var/cache
chown -R nobody.nobody /usr/local/squid/var/logs
http_port 10.80.11.212:80 vhost vport
icp_port 0
cache_mem 1024 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 20000 KB
maximum_object_size_in_memory 4096 KB
cache_dir ufs /usr/local/squid/var/cache 10000 16 256
ipcache_size 10240
fqdncache_size 10240
cache_store_log none
emulate_httpd_log on
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
pid_filename /usr/local/squid/squid.pid
cache_log /usr/local/squid/var/cache/cache.log
access_log /usr/local/squid/var/logs/access.log combined
cache_mgr yhl@zjhcsoft.com
memory_pools off
memory_pools_limit none
#local mamage
acl manager proto cache_object
acl localhost src 127.0.0.1 10.80.11.212
http_access allow manager localhost
http_access deny manager
acl all src 0.0.0.0/0.0.0.0
http_access allow all
#deny this file cache
acl QUERY urlpath_regex cgi-bin .jsp .do .php .cgi .avi .wmv .rm .ram .mpg .mpeg .zip .exe
cache deny QUERY
#acl picurl url_regex -i \.bmp$ \.png$ \.jpg$ \.gif$ \.jpeg$
#acl mystie1 referer_regex -i ct10000
#http_access allow mystie1 picurl
#acl nullref referer_regex -i ^$
#http_access allow nullref
#acl hasref referer_regex -i .+
#http_access deny hasref picurl
cache_peer 10.80.11.208 parent 80 0 no-query originserver name=web1
cache_peer_domain web1 zj.163.com
cache_effective_user nobody
cache_effective_group nobody
/usr/local/squid/sbin/squid -zX
/usr/local/squid/sbin/squid -k parse
/usr/local/squid/sbin/squid -N -d1
出现2010/06/21 15:36:44| Ready to serve requests. 说明启动成功
然后 ctrl + c,停止squid,并以后台运行的方式启动它
/usr/local/squid/sbin/squid -s
/usr/local/squid/sbin/squid -k shutdown
要执行两次才能正常关闭squid
/usr/local/squid/sbin/squid -k reconfigure
/usr/local/squid/bin/squidclient -h 10.80.11.203 -p 80 mgr:info
/usr/local/squid/bin/squidclient -h 10.80.11.203 -p 80 mgr:
/usr/local/squid/bin/squidclient -h 10.80.11.203 -p 80 mgr:mem
more /usr/local/squid/var/logs/access.log | grep TCP_MEM_HIT
该指令可以看到在squid运行过程中,有那些文件被squid缓存到内存中,并返回给访问用户
该指令可以看到在squid运行过程中,有那些文件被squid缓存到cache目录中,并返回给访问用户
该指令可以看到在squid运行过程中,有那些文件没有被squid缓存,而是现重原始服务器获取并返回给访问用户