北京SEO

linux中squid3(高命中率)缓存服务器配置

2019/10/10/17:45:33  阅读:2027  来源:谷歌SEO算法  标签: SEO教程

quid cache(简称为Squid)是一个流行的自由软件(GNU通用公共许可证)的代理服务器和Web缓存服务器。Squid有广泛的用途,从作为网页服务器的前置cache服务器缓存相关请求来提高Web服务器的速度,到为一组人共享网络资源而缓存万维网,域名系统和其他网络搜索,到通过过滤流量帮助网络安全,到局域网通过代理上网。Squid主要设计用于在Unix一类系统运行,下面我们来看看squid3(高命中率)缓存服务器配置教程。

今天对我的varnish进行了下小小的压力测试,40s里的8000并发,没有失败一个,估计还可以承受更大的并发,先不说varnish了,我最近找到个命中率很高的squid的配置文件,当然是squid3.0的配置文件,有需要的可以copy回去自己改.

系统:centos 5.x

需要的软件:squid-3.0.STABLE25.tar.gz

1.下载squid

  1. wgethttp://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE25.tar.gz
  2. tarzxfsquid-3.0.STABLE25.tar.gz&&cdsquid-3.0.STABLE25

2.编译squid,代码如下:

  1. ./configure--prefix=/usr/local/squid
  2. --enable-async-io=100
  3. --with-pthreads
  4. --enable-storeio="aufs,diskd,ufs"
  5. --enable-removal-policies="heap,lru"
  6. --enable-icmp
  7. --enable-delay-pools
  8. --enable-useragent-log
  9. --enable-referer-log
  10. --enable-kill-parent-hack
  11. --enable-arp-acl
  12. --enable-default-err-language=Simplify_Chinese
  13. --enable-err-languages="Simplify_ChineseEnglish"
  14. --disable-poll
  15. --disable-wccp
  16. --disable-wccpv2
  17. --disable-ident-lookups
  18. --disable-internal-dns
  19. --enable-basic-auth-helpers="NCSA"
  20. --enable-stacktrace
  21. --with-large-files
  22. --disable-mempools
  23. --with-filedescriptors=65536
  24. --enable-ssl
  25. --enable-x-accelerator-var
  26. make
  27. makeinstall
  28. makeinstall-pinger

3.配置squid,代码如下:

  1. cp/usr/local/squid/etc/squid.conf/usr/local/squid/etc/squid.conf.old
  2. >/usr/local/squid/etc/squid.conf
  3. ln-s/usr/local/squid/etc/squid.conf/etc/squid.conf

squid.conf里的内容,代码如下:

  1. #accellistenport
  2. http_port80accelvhostvport
  3. #acceldomain
  4. cache_peerxx.xx.xx.xxparent800no-queryoriginserverno-digestname=a
  5. cache_peer_domainawww.phpfensi.com
  6. #acl
  7. aclmanagerprotocache_object
  8. acllocalhostsrc127.0.0.1/255.255.255.255
  9. aclSSL_portsport443563
  10. aclSafe_portsport80#http
  11. aclSafe_portsport8080
  12. aclLanSrcsrcall
  13. aclLanDstdstall
  14. aclLanDstDMdstdomainwww.phpfensi.com
  15. aclCONNECTmethodCONNECT
  16. http_accessallowmanagerlocalhost
  17. http_accessdenymanager
  18. http_accessdeny!Safe_ports
  19. http_accessdenyCONNECT!SSL_ports
  20. http_accessallowLanSrc
  21. http_accessallowLanDst
  22. http_accessallowLanDstDM
  23. http_accessdenyall
  24. #base
  25. visible_hostnamewww.phpfensi.com
  26. cache_mgrrocdk890@gmail.com
  27. cache_effective_usersquid
  28. cache_effective_groupsquid
  29. error_directory/usr/local/squid/share/errors/Simplify_Chinese
  30. icon_directory/usr/local/squid/share/icons
  31. mime_table/usr/local/squid/etc/mime.conf
  32. cache_replacement_policylru
  33. #cache_dir
  34. cache_diraufs/var/cache1327686464
  35. cache_diraufs/var/cache2327686464
  36. cache_mem2048MB
  37. max_open_disk_fds0
  38. #maximum_object_size512KB
  39. #maximum_object_size_in_memory256KB
  40. maximum_object_size20MB
  41. maximum_object_size_in_memory8MB
  42. #keepalived
  43. client_persistent_connectionsoff
  44. server_persistent_connectionson
  45. #persistent_request_timeout60seconds
  46. #memory_poolson
  47. #memory_pools_limit64MB
  48. forwarded_foron
  49. log_icp_queriesoff
  50. viaoff
  51. httpd_suppress_version_stringoff
  52. ie_refreshoff
  53. tcp_recv_bufsize32KB
  54. #aclwebservicesrep_headerServer-i^linuxtoneWS^Apache^nginx
  55. #broken_vary_encodingallowwebservices
  56. #hiddenthesquidheader
  57. #reply_header_accessServerdenyall
  58. #reply_header_accessX-Cachedenyall
  59. #reply_header_accessWarningdenyall
  60. #reply_header_accessExpiresdenyall
  61. #reply_header_accessCache-Controldenyall
  62. #reply_header_accessagedenyall
  63. #reply_header_accessAlldenyall
  64. ipcache_size1024
  65. ipcache_low90
  66. ipcache_high95
  67. memory_replacement_policylru
  68. hosts_file/etc/hosts
  69. request_header_max_size128KB
  70. #denycache
  71. hierarchy_stoplistcgi-bin?.php
  72. aclQUERYurlpath_regexcgi-bin?.php
  73. cachedenyQUERY
  74. #request_body_max_size0KB
  75. refresh_pattern^ftp:6020%10080
  76. refresh_pattern^gopher:600%1440
  77. refresh_pattern.020%1440
  78. refresh_pattern-i.css$36050%2880reload-into-ims
  79. refresh_pattern-i.js$144050%2880reload-into-ims
  80. refresh_pattern-i.html$72050%1440reload-into-ims
  81. refresh_pattern-i.jpg$144090%2880ignore-reload
  82. refresh_pattern-i.gif$144090%2880ignore-reload
  83. refresh_pattern-i.swf$144090%2880ignore-reload
  84. refresh_pattern-i.jpg$144050%2880ignore-reload
  85. refresh_pattern-i.png$144050%2880ignore-reload
  86. refresh_pattern-i.bmp$144050%2880ignore-reload
  87. refresh_pattern-i.doc$144050%2880ignore-reload
  88. refresh_pattern-i.ppt$144050%2880ignore-reload
  89. refresh_pattern-i.xls$144050%2880ignore-reload
  90. refresh_pattern-i.pdf$144050%2880ignore-reload
  91. refresh_pattern-i.rar$144050%2880ignore-reload
  92. refresh_pattern-i.zip$144050%2880ignore-reload
  93. refresh_pattern-i.txt$144050%2880ignore-reload
  94. quick_abort_min20KB
  95. quick_abort_max20KB
  96. quick_abort_pct95
  97. connect_timeout1minute
  98. negative_ttl0minutes
  99. read_timeout30seconds
  100. pconn_timeout120seconds
  101. shutdown_lifetime5seconds
  102. strip_query_termsoff
  103. #snmp
  104. #snmp_port3401
  105. #aclsnmppublicsnmp_orgmunitysnsimg
  106. #snmp_accessallowsnmppubliclocalhost
  107. #snmp_accessdenyall
  108. icp_port0
  109. #logfile
  110. emulate_httpd_logon
  111. #logformatcombined%{X-Forwarded-For}>h%ui%un[%tl]“%rm%ruHTTP/%rv”%Hs%<st“%{Referer}>h”“%{User-Agent}>h”%Ss:%Sh
  112. #access_lognone
  113. #access_log/data/logs/access.logcombined
  114. logformatsquid%ts.%03tu%6tr%>a%Ss/%03Hs%<st%rm%ru%un%Sh/%<A%mt
  115. access_log/var/log/squid/access.logsquid
  116. #cache_store_log/var/log/squid/store.log
  117. cache_store_log/dev/null
  118. cache_log/var/log/squid/cache.log
  119. logfile_rotate12
  120. #MISCELLANEOUS
  121. store_objects_per_bucket15
  122. client_dboff

4.创建目录,代码如下:

  1. /usr/sbin/groupaddsquid
  2. /usr/sbin/useradd-gsquidsquid
  3. mkdir-p/var/log/squid
  4. chown-Rsquid:squid/var/log/squid
  5. mkdir-p/var/{cache1,cache2}
  6. chown-Rsquid:squid/var/{cache1,cache2}

初始化squid的cache目录:

/usr/local/squid/sbin/squid -z

启动squid:

/usr/local/squid/sbin/squid -D

如果大家不喜欢这样的启动方式,可以自己去找个squid的启动脚本,这里就不放出了.当squid运行起来了之后,大家可以使用下面这个命令来查看命中率:

/usr/local/squid/bin/squidclient -p 80 mgr:info

好了,具体其他squid的使用命令就只能你们自己去搜了,就到这里了.

广告内容

linux中squid3(高命中率)缓存服务器配置 linux中squid3(高命中率)缓存服务器配置 linux中squid3(高命中率)缓存服务器配置

相关阅读

热门评论

SEO研究中心 SEO研究中心

SEO研究中心提供免费SEO公开课

总篇数170

精选文章

RMAN中catalog和nocatalog区别介绍 小技巧:为Linux下的文件分配多个权限 zimbra8.5.1安装第三方签名ssl证书的步骤 解决mysql不能远程连接数据库方法 windows服务器mysql增量备份批处理数据库 mysql中slow query log慢日志查询分析 JavaScript跨域问题总结 Linux下负载均衡软件LVS配置(VS/DR)教程 mysql中权限参数说明 MYSQL(错误1053)无法正常启动

SEO最新算法