分享一个不错的squid 配置文件
squid配置文件一例,只使用了web cache功能,用来给web加速。
http_port 80 defaultsite=IP
icp_port 0
cache_peer ip parent 85 0 no-query originserver
hosts_file /etc/hosts
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
cache_mem 2000 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 4096 KB
maximum_object_size_in_memory 1024 KB
cache_dir ufs /var/spool/squid 10000 64 256
emulate_httpd_log on
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
access_log /var/log/squid/access.log combined
cache_log none
cache_store_log none
refresh_pattern ^ftp: 10 20% 20
refresh_pattern ^gopher: 10 0% 20
refresh_pattern . 0 20% 20
refresh_pattern -i .html 10 100% 20 reload-into-ims
refresh_pattern -i .shtml 10 100% 20 reload-into-ims
refresh_pattern -i .htm 10 100% 20 reload-into-ims
refresh_pattern -i .gif 10 100% 20 reload-into-ims
refresh_pattern -i .swf 10 100% 20 reload-into-ims
refresh_pattern -i .png 10 100% 20 reload-into-ims
refresh_pattern -i .bmp 10 100% 20 reload-into-ims
refresh_pattern -i .css 10 100% 20 reload-into-ims
refresh_pattern -i .jpg 10 100% 20 reload-into-ims
refresh_pattern -i .txt 10 100% 20 reload-into-ims
refresh_pattern -i .rhtml 10 100% 20 reload-into-ims
refresh_pattern -i .xml 10 100% 20 reload-into-ims
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl to_servers dst IP
acl Safe_ports port 80
acl OverConnLimit maxconn 8
http_access deny OverConnLimit
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access allow to_servers
http_access deny all
http_reply_access allow all
icp_access allow all
visible_hostname cache15
cache_mgr admin@jbxue.COM
redirect_rewrites_host_header off
half_closed_clients off
allow_underscore on
pid_filename /usr/local/squaid/var/logs/squid.pid
logfile_rotate 10
coredump_dir /var/spool/squid
本文原始链接:http://www.jbxue.com/article/2176.html