Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1117272
  • 博文数量: 187
  • 博客积分: 1156
  • 博客等级: 少尉
  • 技术积分: 2163
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-16 15:01
个人简介

go!go!go!

文章分类

全部博文(187)

文章存档

2024年(1)

2023年(11)

2022年(13)

2021年(15)

2020年(38)

2019年(3)

2018年(6)

2016年(1)

2015年(16)

2014年(13)

2013年(24)

2012年(46)

分类: 系统运维

2012-03-11 14:51:48

错误码:
  1. HTTP/1.0 403 Forbidden
  2. X-Squid-Error: ERR_ACCESS_DENIED 0
排查方法:
1.初步判断该错误码,应该是在访问squid时进行acl 校验时被断开的。
2.因此,需要打开acl校验的相关代码的debug信息,在squid代码中src/http.c
3.在http.c文件开始处可以找到如下注释
  1. DEBUG: section 33 Client-side Routine
4.于是需要打开squid.conf中的 debug_options 选项,配置如下:
  1. debug_options 33,9
执行
  1. squid -k reconfigure

5.再次查看日至cache.log,看到类似如下信息

  1. 2012/03/11 15:10:27| The request GET is DENIED, because it matched 'localnet'
  2. 2012/03/11 15:10:27| Access Denied:
  3. 2012/03/11 15:10:27| AclMatchedName = localnet
  4. 2012/03/11 15:10:27| Proxy Auth Message =
  5. 2012/03/11 15:10:27| clientSendHeaders: FD 14 ''
  6. 2012/03/11 15:10:27| clientBuildReplyHeader: Error, don't keep-alive
6.问题定位了,再打开squid.conf,查找,localnet的acl,如下
  1. acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
  2. acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
  3. acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
对应localnet的http_access设置如下:
  1. http_access allow localnet
  2. # And finally deny all other access to this proxy
  3. http_access deny all


而我是用curl访问的squid:
  1. curl -x 127.0.0.1:8080 -svo /dev/null
127.0.0.1不在localnet中,所以会被
http_access deny all
这行给deny掉。
所以要在上面加上http_access allow localhost,
 
然后在squid -k reconfigure
最后,再次curl通过127.0.0.1也可以成功访问到squid





阅读(11345) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~