免费注册 查看新帖 |

Chinaunix

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

[proxy] 求助~ 在一台WEB服务器上搭建squid做反向代理失败 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-09-07 16:20 |只看该作者 |倒序浏览
visible_hostname test.com
http_port 134.234.102.2:81 vhost vport


icp_port 0

cache_mem 200 MB


cache_swap_low 90
cache_swap_high 95

maximum_object_size 20000 KB



maximum_object_size_in_memory 4096 KB


cache_dir ufs /usr/local/squid/var/cache 10000 16 256


cache_store_log none


emulate_httpd_log on




pid_filename /var/log/squid/squid.pid
cache_log /var/log/squid/cache.log
access_log /var/log/squid/access.log combined


acl all src 0.0.0.0/0.0.0.0
http_access allow all
acl QUERY urlpath_regex cgi-bin .cgi .avi .wmv .rm .ram .mpg .mpeg .zip .exe
cache deny QUERY



#acl picurl url_regex -i \.bmp$ \.png$ \.jpg$ \.gif$ \.jpeg$
#acl mystie1 referer_regex -i aaa
#http_access allow mystie1 picurl
#acl mystie2 referer_regex -i bbb
#http_access allow mystie2 picurl


#acl nullref referer_regex -i ^$
#http_access allow nullref
#acl hasref referer_regex -i .+
#http_access deny hasref picurl


cache_peer 134.234.102.2 parent 80 0 no-query originserver


cache_effective_user nobody
cache_effective_group nobody

squid安装过程没有出现错误提示.

(配置好squid, 配置文件在上面,然后squid -z 运行成功,但是在cache目录下没有自动生成目录.squid -s,启动成功. test.com已经在hosts里指定 134.234.102.2 test.com .apache我用的80端口.
因为我还有其他项目在服务器上,所以不能改APACHE 80端口,我就让squid用81端口来测试.
然后在本机下配置好hosts,在IE下访问 test.com是OK,但是test.com:81就不能访问. 怎么squid 没有起反向代理的作用呢? 我搞了好久了,希望有能力的朋友帮兄弟看看 . 兄弟在此谢谢了 ~  ^^ )




visible_hostname test.com
http_port 134.234.102.2:81 vhost vport
上面两句是指squid 监听服务器上test.com域名和服务器上81端口吗?

cache_peer 134.234.102.2 parent 80 0 no-query originserver
上面一句是指监听服务器上80端口,反向代理服务器上test.com域名80端口?

个人理解是,用户如果 test.com:81访问服务器,服务器上squid因该起反向代理作用,找缓存,如果没有就调
test.com:80 apache服务器的内容并缓存.


我的配置不成功,往达人指导我一下,看我的配置和想法是否哪有不对的地方. 小弟在此多谢了.

[ 本帖最后由 shangdi12 于 2007-9-7 16:32 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2007-09-07 23:59 |只看该作者
先看看这些吧
http://post.baidu.com/f?kz=94686749

好像你的配置应该变为
visible_hostname test.com
http_port 134.234.102.2:81 vhost vport


cache_mem 200 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 20000 KB
maximum_object_size_in_memory 4096 KB


cache_dir ufs /usr/local/squid/var/cache 10000 16 256


cache_store_log none


emulate_httpd_log on




pid_filename /var/log/squid/squid.pid
cache_log /var/log/squid/cache.log
access_log /var/log/squid/access.log combined

cache_effective_user nobody
cache_effective_group nobody

acl QUERY urlpath_regex cgi-bin .cgi .avi .wmv .rm .ram .mpg .mpeg .zip .exe
cache deny QUERY

cache_peer 134.234.102.2 parent 80 0 no-query originserver

acl all src 0.0.0.0/0.0.0.0
http_access allow all


小第也是初学,请多多指教

论坛徽章:
0
3 [报告]
发表于 2007-09-08 09:33 |只看该作者
建议
http_port 134.234.102.2:81 vhost vport ,这里把81改成80端口,这样就由squid监听80端口,然后本机apache开81端口
cache_peer 127.0.0.1 parent 81 0 no-query originserver
这里有个小小的改动,我建议你可以使用127这个内部ip地址试试,
这样当你在访问你的主页就可以起到代理的作用了

论坛徽章:
0
4 [报告]
发表于 2007-09-10 10:29 |只看该作者
多谢楼上两位兄弟的帮助. 我已在本机搭建成立,服务器上暂时还未成功,不过本机成功,问题也就不大了.
先上来感谢大家的帮助,然后自己再去研究下之前不成功问题所在.  ~ THANKS

论坛徽章:
0
5 [报告]
发表于 2012-03-31 17:57 |只看该作者
这个,新人搜squid的内容进的这个帖子,貌似是Ip地址写错了的原因?
我这是挖坟了么

论坛徽章:
0
6 [报告]
发表于 2012-03-31 23:46 |只看该作者
路漫漫其修远兮,不如我们去打的。

顶一个先
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP