免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6150 | 回复: 3
打印 上一主题 下一主题

[proxy] 反向代理squid中/etc/hosts解析记忆的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-11-13 10:44 |只看该作者 |倒序浏览
5可用积分
squid功能开启后,假如一个用户通过squid代理成功的访问了www.sina.com.cn,现在我有两个问题:
1. 此时如果我把squid的解析ip的/etc/hosts文件中关于www.sina.com.cn的记录删除,那个用我代理的用户依然可以访问。是不是squid内部的dns也有记忆的功能?我怎么才可以去掉它的记忆功能?ps:我重启squid服务(按理说内部的dns也应该清空记录了吧),用户还是可以访问。。。。
2. 既然第一种方法不行,我就改了squid.conf。想想这里的规则应该可以限制www.sina.com.cn了吧,于是我把相应的www.sina.com.cn cach_peer注释掉(红色部分),重启squid服务。但是用户还是可以通过squid去取www.sina.com.cn的数据。也就是说,我修改了规则也没作用?有没有办法可以清除这种squid记忆的功能?

http_port 80  vhost vport
#acl apache rep_header Server ^Apache
#broken_vary_encoding allow apache
cache_mem 512 MB
maximum_object_size 4096 KB
#minimum_object_size 0 KB
#maximum_object_size_in_memory 256 KB
cache_dir ufs /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
cache_access_log /usr/local/squid/var/logs/access.log
cache_log /usr/local/squid/var/logs/cache.log
cache_store_log none
pid_filename /usr/local/squid/var/logs/squid.pid
hosts_file /etc/hosts
refresh_pattern ^ftp: 1440 20% 1440
refresh_pattern -i .gif 10 40% 30 ignore-reload
refresh_pattern -i .jpg 10 40% 30 ignore-reload
refresh_pattern -i .png 10 40% 30 ignore-reload

acl all src 0.0.0.0/0.0.0.0
acl QUERY urlpath_regex cgi-bin .aspx .php .cgi .asp
cache deny QUERY

cache_mgr wunai@henwuyu.com
cache_effective_user nobody
cache_effective_group nobody
visible_hostname yumen
acl OverConnLimit maxconn 16
http_access deny OverConnLimit

acl Manager proto cache_object
acl Localhost src 127.0.0.1
http_access allow Manager Localhost
http_access deny Manager

acl Safe_ports port 80
http_access deny !Safe_ports
http_access allow all

#tcp_recv_bufsize 65535 bytes
acl 163 dstdomain www.163.com
acl sina dstdomain www.sina.com.cn
#cache_peer www.163.com parent 80 0 no-query originserver no-digest
#cache_peer www.sina.com.cn parent 80 0 no-query originserver no-digest
#cache_peer_access www.sina.com.cn deny !sina
#cache_peer_access www.163.com deny !163


icp_port 0
#error_directory  /usr/local/squid/share/errors/Simplify_Chinese

coredump_dir  /usr/local/squid/var/logs/dump

最佳答案

查看完整内容

你把cache 关于sina的内容都清空看看

论坛徽章:
0
2 [报告]
发表于 2008-11-13 10:44 |只看该作者
你把cache 关于sina的内容都清空看看

论坛徽章:
0
3 [报告]
发表于 2008-11-13 10:50 |只看该作者
但是只要我把squid服务停止,用户就登陆不了对应的网站了,所以我怀疑squid自己有记忆的功能,在第二次接到访问sina的请求时,自己连规则都不验证,就去取数据了,不知道我理解的对不对,请大家指正。

论坛徽章:
0
4 [报告]
发表于 2008-11-28 12:34 |只看该作者
确实是缓存的问题,自己太菜了。。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP