分享一个不错的squid 配置文件

本文详细介绍了Squid代理服务器的配置方法,重点展示了如何通过配置文件启用webcache功能,实现web加速。包括http_port、cache_peer、acl、cache_dir等关键参数设置,以及对特定文件类型的缓存策略。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

转载于:https://www.cnblogs.com/cfinder010/p/3353440.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值