squid配置文件 squid.conf

################## 基本信息配置 ##################

#设置代理服务器名称

visible_hostname www.testsquid.com

#设置缓存服务器管理员邮箱

cache_mgr wangw@wisedu.com

#设置运行squid的用户和组

cache_effective_user nobody

cache_effective_group nobody

#################缓存相关参数设置################

#设置缓存内存大小,最大使用内存为1024M,

#当使用超过95%时开始对缓存进行替换,直到下降到90%后停止。

cache_mem 1024 MB

cache_swap_low 90

cache_swap_high 95

#设置磁盘中可缓存的最大文件大小

maximum_object_size 12000 KB

#设置内存中最大可缓存的最大文件大小

maximum_object_size_in_memory 1024 KB

#设置缓存文件夹的路径和参数,10000表示10G大小,目录下面分为16级,每级又有256个目录

cache_dir ufs /var/spool/squid 10000 16 256

#设置缓存日志文件路径

cache_access_log /var/log/squid/access.log

cache_log /var/log/squid/cache.log

cache_store_log /var/log/squid/store.log

###########反向代理相关设置#################################

#设置反向代理服务器监听的端口为80,accel表示开启squid的accel加速模式,

#vhost和vport表示支持虚拟主机和虚拟端口,如果再加上transparent表示支持透明代理

http_port 80 accel vhost vport

#cache_peer表示如果本机缓存中找不到客户端请求的数据,将与主机www.zcu.com以parent类型进行联系,no-query表示不使用ICP协议进行联系,而是使用HTTP协议进行联系,联系端口是80,orginserver表示此服务器是源服务器,name表示别名。

cache_peer www.testsquid.com parent 80 0 no-query originserver name=testsquidone

cache_peer www.testsquidtwo.com parent 80 0 no-query originserver name=testsquidtwo

cache_peer www.testsquidthree.com parent 80 0 no-query originserver name=testsquidthree

#设置别名所对应的域名,如果cache_peer中使用域名而不是IP的话,那么cache_peer_domain中一定要用相同的域名,否则无法访问。

cache_peer_domain testsquidone www.testsquid.com

cache_peer_domain testsquidtwo www.testsquidtwo.com

cache_peer_domain testsquidthree www.testsquidthree.com

#设置访问控制,允许所有客户端访问上面设置的三个网站

http_access allow all

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值