余志国网站设计工作室是专业从事义乌网站建设、义乌外贸网站建设、义乌网站制作、义乌网站设计的专业义乌网站建设工作室,是义乌外贸网站建设专家!

windows 2003通过squid搭建cdn节点加速服务

分类:程序开发 Tags: win2003 squid cdn cdn加速 服务器配置 评论:0 浏览:5719 最近更新时间:2014/8/23 13:38:44

quid for windows 下载地址:http://squid.acmeconsulting.it/download/squid-3.0.STABLE23-BZR-bin.zip 这是3.0的。

稳定版是2.6的。下载地址:http://squid.acmeconsulting.it/download/squid-2.6.STABLE23-bin.zip
2.6的配置与下面的不大兼容。

把压缩包直接解压到C盘即可。。完成后的目录应该是 c:\squid 。。据听说如果更改目录,需要修改很多文件。。

然后就是写配置文件。在c:\squid\etc\里面,把3个文件都备份一下,然后把文件名末尾的.default都删掉。。

打开squid.conf,清空后填入如下内容。

http_port 80 vhost vport=80
acl apache rep_header Server ^Apache
cache_mem 1024 MB //这里是占用内存的大小,根据自己的配置来,可以设置为总内存的三分之二。
maximum_object_size 4096 KB
minimum_object_size 0 KB
maximum_object_size_in_memory 256 KB
cache_dir ufs d:/squid-cache/cache 20480 16 256 //此处是缓存文件的目录,填成你想使用的目录即可。但是这个目录一定要建好。
cache_swap_low 80
cache_swap_high 97
strip_query_terms off
request_body_max_size 5 MB
memory_pools on
memory_pools_limit 50 MB
access_log none
cache_log d:/squid-cache/log/cache.log //日志存放目录
cache_store_log none
pid_filename d:/squid-cache/log/squid.pid //日志存放目录
hosts_file C:\WINDOWS\system32\drivers\etc\hosts //hosts文件位置,windows都是这个,不需要改动。
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i .gif 180 20% 10080 override-expire ignore-reload reload-into-ims
refresh_pattern -i .jpg 180 20% 10080 override-expire ignore-reload reload-into-ims
refresh_pattern -i .css 180 20% 10080 override-expire ignore-reload reload-into-ims
refresh_pattern -i .html 180 20% 10080 override-expire ignore-reload reload-into-ims
refresh_pattern -i .js 180 20% 10080 override-expire ignore-reload reload-into-ims
refresh_pattern -i .png 180 20% 10080 override-expire ignore-reload reload-into-ims //以上几条是标注需要缓存的文件后辍。自己看着填吧,需要填什么就填什么。每条一个后辍。
refresh_pattern . 120 50% 1440
acl p-manager proto cache_object
acl s-localhost src 127.0.0.1/255.255.255.255
acl d-localhost dst 127.0.0.0/8
acl d-domains dstdomain www.yuzhiguo.com //这里填要缓存的域名。域名不多的话直接直接在这里写就行,每行一个域名,格式都照这一条就成。。如果实在多,可以列成一个文本文件 如c:/squid/domain.txt 然后所有域名都放里面,每行一个域名。我这里填的是只有这一个域名,如果需要所有二级域名都可以访问的话,可以用 .yuzhiguo.com即包括了所有二级域名。
acl p-ssl port 443 563
acl p-safe port 80 443 563
acl m-conn method CONNECT
acl m-purge method PURGE
acl n-maxconn maxconn 15
http_access allow p-manager s-localhost
http_access allow m-purge
http_access deny !p-safe
http_access deny m-conn !p-ssl
http_access deny n-maxconn
http_access allow p-manager
http_access allow d-domains
http_access deny all
http_reply_access allow all
acl r-url urlpath_regex realtime
cache deny r-url
icp_access allow all
dns_timeout 5 seconds
forward_timeout 10 seconds
connect_timeout 10 seconds
peer_connect_timeout 6 seconds
read_timeout 10 seconds
request_timeout 6 seconds
persistent_request_timeout 16 seconds
cache_mgr vip@yuzhiguo.com  //联系邮箱,出现错误时会有提示。
visible_hostname cdn1.yuzhiguo.com //节点名称,如果多个节点的话,比较容易分出是哪个节点。
logfile_rotate 0
always_direct allow all
#error_directory /usr/local/squid/share/errors/Simplify_Chinese //这行不需要处理,但是要写上。
coredump_dir d:/squid-cache/log/squid // 还是改为自己的日志目录


写完配置文件后,保存。
进入命令行模式。然后进入c:\squid\sbin 目录
执行

squid -i //写入windows 服务
squid -z //配置cache目录

好了,可以到管理工具>服务里,启动squid。

下面开始做域名解析.
打开目录C:\WINDOWS\system32\drivers\etc
用记事本打开hosts编辑并保存,ip地址是指你目标站的ip地址

175.102.7.22       www.yuzhiguo.com

主服务器:175.102.7.22
CDN服务器:175.102.*.*域名解析到这个安装squid的IP


本文地址:/513/
  • 相关文章
  • 推荐文章
  • 最新文章
发表评论





您的IP:18.97.14.82,来自:

留言

 


免费咨询
建站咨询热线
15967985565
QQ: 358758308 Skype: yuzhiguo Facebook: yuzhiguo Email