热门关键字:  ubuntu  分区  Fedora  linux系统进程  函数

squid加速的web站点

来源: 作者: 时间:2007-03-01 Tag: 点击:
--disable-internal-dns,不允许squid使用dns解析。
然后我们需要编辑/etc/hosts文件,在其中加上我们需要加速的web站点的域名及ip对应关系,如
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost localhost.localdomain localhost
211.86.9.1 www.sdada.edu.cn sdada.edu.cn test2.sdada.edu.cn
221.214.14.215 rencai.design.sd.cn
221.214.14.226 guqunye.com www.guqunye.com
221.214.14.235 www.qqxq.net qqxq.net www.qqxq.com qqxq.com

接下来,我们需要将需要加速的web站点的域名,从dns解析上,全部指向安装squid的这台服务器,这样就比较清楚的明白其工作原理了,首先用户请求某一域名,被指向cache服务器(安装squid的服务器),然后squid根据其主机上的hosts表,会去访问web站点所在的真实服务器。

最后需要编辑squid的配置文件,默认在/usr/local/squid/etc/squid.conf
在最后添加如下内容:


http_port 80
icp_port 0

dns_children 20
redirect_children 20

cache_mem 256 MB
cache_dir ufs /usr/local/squid/cache 2048 16 256
log_icp_queries off
buffered_logs off
emulate_httpd_log off
redirect_rewrites_host_header off
half_closed_clients off

cache_swap_high 100
cache_swap_low 80
maximum_object_size 1024 KB

refresh_pattern -i .html 1440 100% 129600 reload-into-ims
refresh_pattern -i .shtml 1440 100% 129600 reload-into-ims
refresh_pattern -i .hml 1440 100% 129600 reload-into-ims
refresh_pattern -i .gif 1440 100% 129600 reload-into-ims
refresh_pattern -i .swf 1440 100% 129600 reload-into-ims
refresh_pattern -i .png 1440 100% 129600 reload-into-ims
refresh_pattern -i .bmp 1440 100% 129600 reload-into-ims
refresh_pattern -i .js 1440 100% 129600 reload-into-ims

http_access deny all
cache_mgr gf_l@hotmail.com
cache_effective_user squid
cache_effective_group squid
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_uses_host_header on


visible_hostname cache2.sdada.edu.cn


然后需要添加squid用户及组,以及建立cache目录并且改为squid用户所有。
然后运行
#/usr/local/squid/sbin/squid -z
初始化cache目录
上一篇:squid Cache拦截
下一篇:优化squid配置


相关文章:
eG Citrix 监控器
Ethernet的帧格式和结构
华为(Quidway AR18-22-24)路由器配置实例
简单利用路由黑洞解决DDOS流量攻击
我的linux试验题目
如何在HMC上激活网络时间协议NTP
Resin泛解析 - 三级域名最优应用方案
Resin多域名绑定 + 泛解析
resin 负载均衡
linksys wap54g 设置注意事项
acegi RememberMe&退出&匿名登陆
vnd命令~
LINUX网卡绑定
TCP包首部
IP包首部格式
指纹锁也不靠谱 电脑“破解”六大事件!
linux配置网关
使用 SCTP 优化网络
IPv4/IPv6过渡技术和方案分析
用三个源码包libnet、libnids、libpcap轻松搭建Li
Extensible Messaging and Presence Protocol (XM
组建CISCO多层交换网络入门
CISCO多层交换机的初始配置和排错
实施和配置VLAN
理解和配置802.1Q/802.1S和802.1W生成树协议
理解和配置cisco特定的生成树协议特性和STP排错
配置第二层和第三层的特性
理解和配置VLAN间的路由选择
理解和配置多层交换
理解和配置cisco多层交换网络中的服务质量