操纵Squid + DNSPOD 搭建CDN服务器心得[服务器安全]
本文“操纵Squid + DNSPOD 搭建CDN服务器心得[服务器安全]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
我的个人网站 www.game1988.com 近来很多人反映拜候速度很慢,后来我知道本来服务器一向搭建在铁通线路上,造成国内的电信线路用户有时刻网页都打不开,所以闲暇时间我做了一个CND加快服务器,其实就是操纵Squid + DNSPOD的方法实现南北电信互联互通.
PS:由于网站性质问题,在国内不能备案,目前已经迁往海外主机,不过我相信这篇文章应当能帮忙到需求给自己网站加快的朋友们 :)
说名一下,www.game1988.com主服务器IP为61.234.243.31为湖南铁通网络
因为中国网络问题,一些电信誉户拜候速度较慢,
所以,我挑选了用中国电信的光纤服务器做CDN,服务器IP为218.75.215.11
也就是
主服务器:61.234.243.31
CDN服务器:218.75.215.11
首先下载squid for windows安装包 squid-2.7.STABLE5-bin.zip
然后解紧缩,放到C盘squid目录内.
进入目录C:\squid\etc内,将全部文件的.default全部删掉
编辑下squid.conf,将全部内容删掉,替换以下内容,并保存
http_port 80 vhost vport=80
acl apache rep_header Server ^Apache
broken_vary_encoding allow 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 c:/squid/var/cache 40960 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 none c:/squid/var/logs/cache.log
cache_store_log none
pid_filename c:/squid/var/logs/squid.pid
hosts_file C:\WINDOWS\system32\drivers\etc\hosts
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 . 120 50% 1440
acl all src 0.0.0.0/0.0.0.0
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 .game1988.com
acl d-domains dstdomain www.game1988.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 allow !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 allow all
http_reply_access allow all
acl r-url urlpath_regex realtime
cache deny r-url
icp_access allow all
follow_x_forwarded_for allow all
acl_uses_indirect_client offrange_offset_limit -1
dns_timeout 2 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 edsoki@163.com
cache_effective_user nobody
cache_effective_group nobody
visible_hostname www.game1988.com
logfile_rotate 0
always_direct allow all
#error_directory /usr/local/squid/share/errors/Simplify_Chinese
coredump_dir c:/squid/var/cache
access_log c:/squid/var/logs/access.log squid
cache_log c:/squid/var/logs/cache.log
cache_store_log c:/squid/var/logs/store.log
翻开目录c:\squid\var
新建两个目录,辨别为cache和logs
翻开CMD,进入c:\squid\sbin目录,履行squid -i 将SQLUID写入服务项
初始化cache目录squid -z 假如配置文件出错的话,初始化cache目录将会出错.
关闭或禁用IIS
在服务里面运行squid
———–到这里,squid部份就搭建成功了
下面开始做域名解析.
翻开目录C:\WINDOWS\system32\drivers\etc
用记事本翻开hosts编辑并保存
61.234.243.31 www.game1988.com game1988.com
DNSpod大家城市用啦,
把域名NS服务器换到DNSpod上来
然后将电信IP指向61.234.243.31
将网通IP指向218.75.215.11
等A记录见效……..
见效后,初次翻开网站速度大概会慢,大概出错吧,二次拜候后速度就会飞快啦,呼呼~~~
以上是“操纵Squid + DNSPOD 搭建CDN服务器心得[服务器安全]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |