设为首页 收藏本站
查看: 963|回复: 0

[经验分享] 分享squid缓存服务器配置

[复制链接]

尚未签到

发表于 2018-12-27 13:14:58 | 显示全部楼层 |阅读模式
  分享下自己测试squid缓存节点配置文件:
  squid版本:
  Squid Cache: Version 3.1.5
  http_port 80 vhost
http_port 8080 vhost vport
icp_port 0
unique_hostname host57
dns_nameservers  192.168.1.100
  cache_dir aufs /data/cache/cache1 40960 16 256 max-size=204800
cache_dir aufs /data/cache/cache2 40960 16 256 max-size=204800
  logformat  cdn  %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %>Hs %h" "%{User-Agent}>h" %Ss:%Sh
cache_log /data/cache/logs/cache.log
access_log /data/cache/logs/access.log  cdn
cache_store_log none
  cache_effective_user squid
cache_effective_group  squid
tcp_recv_bufsize 65535 bytes
logfile_rotate 4
  pid_filename /usr/local/squid/var/logs/squid.pid
  cache_mem  2048 MB
cache_swap_low 85
cache_swap_high 95
  maximum_object_size 4096 KB
maximum_object_size_in_memory 512 KB
reply_body_max_size 5116 KB
minimum_object_size 1 bytes
  ipcache_size 65535
fqdncache_size 65535
cache_replacement_policy heap LFUDA
memory_replacement_policy heap LFUDA
  request_header_max_size 32 KB
quick_abort_min -1 KB
read_ahead_gap 16 KB
negative_ttl 0 minutes
range_offset_limit -1 KB
client_lifetime 60 minutes
half_closed_clients off
pconn_timeout 100 seconds
shutdown_lifetime 20 seconds
  cache_mgr admin@5iqiong.com
httpd_suppress_version_string off
visible_hostname 51cdn.cn
memory_pools_limit 64 MB
via off
  forwarded_for on
store_avg_object_size 32 KB
store_objects_per_bucket 256
strip_query_terms off
coredump_dir /data/cache/logs
  ################Purge#########################
acl AdminBoxes src 127.0.0.1
acl Purge method PURGE
http_access allow AdminBoxes Purge
http_access deny Purge
  hierarchy_stoplist cgi-bin ?
hierarchy_stoplist -i ^https:\\ ?
acl QUERY urlpath_regex -i cgi-bin \? \.php \.xml \.jsp \.js \.do
acl denyssl urlpath_regex -i ^https:\\
acl dy_cache urlpath_regex swf\?
acl dy_cache urlpath_regex html\?
acl dy_cache urlpath_regex htm\?
acl dy_cache urlpath_regex exe\?
acl dy_cache urlpath_regex css\?
acl dy_cache urlpath_regex js\?
acl dy_cache urlpath_regex cab\?
acl dy_cache urlpath_regex asp\?
acl dy_cache urlpath_regex aspx\?
acl dy_cache urlpath_regex php\?
acl dy_cache urlpath_regex jsp\?
  acl dy_page url_regex -i ^http:\/\/www1\.5iqiong\.com\/.*\?.*$
acl dy_page url_regex -i ^http:\/\/www2\.5iqong\.com\/.*\?.*$
  no_cache deny QUERY
no_cache deny denyssl
no_cache deny dy_cache
no_cache deny dy_page
  acl www dstdomain .5iqiong.com
always_direct allow www
http_access allow www
  ##############Refresh_pattern#################
refresh_pattern -i ^http:\/\/(www1|www2)\.5iqiong\.com\/.*\.(html|jpeg|bmp|png|gif)  120 100%  240 reload-into-ims
refresh_pattern -i \/$ 15 90% 600 reload-into-ims
refresh_pattern -i \.html$ 15 90% 60 reload-into-ims
refresh_pattern -i \.htm$ 15 90% 600 reload-into-ims
refresh_pattern -i \.shtml$ 15 90% 600 reload-into-ims
refresh_pattern -i \.vhtml$ 30 90% 600 reload-into-ims
refresh_pattern -i \.hml$ 15 90% 600 reload-into-ims
refresh_pattern -i \.php$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.asp$ 15 90% 600 reload-into-ims
refresh_pattern -i \.jsp$ 1440 90% 8640 reload-into-ims
refresh_pattern -i \.gif$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.swf$ 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 \.bmp$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.js$ 120 90% 600 reload-into-ims
refresh_pattern -i \.css$ 120 90% 600 reload-into-ims
refresh_pattern -i \.wma 1440 90% 21600 reload-into-ims
refresh_pattern -i \.zip 1440 90% 21600 reload-into-ims
refresh_pattern -i \.mp3 1440 90% 21600 reload-into-ims
refresh_pattern -i \.rar 1440 90% 21600 reload-into-ims
refresh_pattern -i \.flv$ 1440 90% 21600 reload-into-ims
refresh_pattern -i \.wmv$ 1440 90% 21600 reload-into-ims
refresh_pattern -i \.exe$ 1440 90% 21600 reload-into-ims
refresh_pattern .               0       20%     4320
  acl manager proto cache_object
acl ownhost src 192.168.1.0/24
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl Safe_ports port 8080    # proxy
acl Safe_ports port 80      # Web
acl SSL_ports port  443     #https
acl CONNECT method CONNECT
  http_access allow ownhost
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny all
icp_access allow  all
  ##############http-header###############################
reply_header_access Via deny all
reply_header_access Cache-Control deny all
reply_header_access Server deny all
reply_header_access X-Squid-Error deny all
reply_header_access X-Forwarded-For deny all
request_header_access Via deny all
request_header_access Age deny all
request_header_access X-Squid-Error deny all
request_header_access Pragma deny all
#request_header_access X-Forwarded-For deny all




运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-656512-1-1.html 上篇帖子: 超详细搭建Squid日志分析 下篇帖子: Squid 3.1.7通过mysql_auth方式认证
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表