免费注册 查看新帖 |

Chinaunix

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

[proxy] squid普通代理求助 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-05-14 17:30 |只看该作者 |正序浏览
本帖最后由 12fzm34 于 2011-05-16 21:28 编辑

环境:Vmware7.1虚拟机环境
      Linux:Rhl6.0_x64  eth0:10.0.0.3
         Win2003                 eth0:10.0.0.4
         Squid_3.1.4_l.el6.x86_64用的是rpm包安装。
  现在做一般代理,linux能够上网,win2003代理填写的10.0.0.3端口8888,能够在win2003上ping通linux的eth0的10.0.0.3,但是用代理上网不能,以下是squid.conf里的配置:已经快疯掉了!有谁能帮我一下,后面还要配置方向代理,这都不通后面更不好配了。谢谢谢谢!!!
#
# Recommended minimum configuration:
#
acl win src 10.0.0.4/32
http_access allow win
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl localhost src ::1/128
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl to_localhost dst ::1/128

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7   # RFC 4193 local private network range
acl localnet src fe80::/10  # RFC 4291 link-local (directly plugged) machines

acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT

#
# Recommended minimum Access Permission configuration:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access allow manager

# Deny requests to certain unsafe ports
http_access allow !Safe_ports

# Deny CONNECT to other than secure SSL ports
http_access allow CONNECT !SSL_ports

# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all

# Squid normally listens to port 3128
http_port 8888 vhost vport

# We recommend you to use at least the following line.
hierarchy_stoplist cgi-bin ?

# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /var/spool/squid 100 16 256.
# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid

# Add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320

#cache_mem
cache_mem  128 MB

#cache_mgr
cache_mgr root@example.com

#visible_hostname
visible_hostname squids

dns_nameservers 202.103.24.68


启动过程没有问题,防火墙已关闭,修改了下配置文件,现在客户机可以访问代理了
但是提示下面错误:
当尝试取回该 URL 时遇到下面的错误:http://www.163.com/

目前无法将您的请求进行转送操作

您的请求无法被转送到原始网络服务器或其他的上层缓存服务器,发生这个问题最可能的原因是缓存服务器管理员不允许本服务器与原始网络服务器直接连结,而 所有本服务器指定的上层缓存服务器都暂时无法连结。

缓存服务器的管理员 root@example.com.

这是cache.log的内容:
2011/05/14 03:24:43|    never_direct = 0
2011/05/14 03:24:43|        timedout = 0
2011/05/14 03:24:54| Failed to select source for 'http://www.sina.com.cn/'
2011/05/14 03:24:54|   always_direct = 0
2011/05/14 03:24:54|    never_direct = 0
2011/05/14 03:24:54|        timedout = 0
2011/05/14 03:24:54| Failed to select source for 'http://www.squid-cache.org/Artwork/SN.png'
2011/05/14 03:24:54|   always_direct = 0
2011/05/14 03:24:54|    never_direct = 0
2011/05/14 03:24:54|        timedout = 0

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
22 [报告]
发表于 2011-05-17 20:44 |只看该作者
我觉得楼主的文档是不是有问题,或者楼主看文档串行了?

论坛徽章:
0
21 [报告]
发表于 2011-05-17 20:31 |只看该作者
本帖最后由 12fzm34 于 2011-05-17 21:43 编辑

删除http_port 8888 vhost vport后面的vhost vport问题就解决了!

     我继续在配置透明代理,最后的反向代理才是目标

   感谢大家的帮忙!!如果有什么问题我会继续在这个帖子上面发,希望这个帖子能帮助到更多的人!在次感谢!!!!

论坛徽章:
0
20 [报告]
发表于 2011-05-17 16:54 |只看该作者
回复 19# chenyx


    说滴对

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
19 [报告]
发表于 2011-05-17 16:43 |只看该作者
http_port 8888

这句应该是重点

论坛徽章:
0
18 [报告]
发表于 2011-05-17 15:50 |只看该作者
回复 16# shanghan


    我还没有测试,那一句是关键问题所在???我想问问谢谢了

论坛徽章:
0
17 [报告]
发表于 2011-05-17 15:45 |只看该作者
普通代理和cdn... 相关配置参数,多看看就好

论坛徽章:
0
16 [报告]
发表于 2011-05-17 14:26 |只看该作者
贴上在你的基础上修改的文件,测试过了正常使用

acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl localnet src 172.23.0.0/16  # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access allow manager
http_access allow !Safe_ports
http_access allow CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access deny all
http_port 8888
hierarchy_stoplist cgi-bin ?
cache_dir ufs /var/spool/squid 100 16 256.
coredump_dir /var/spool/squid
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320
cache_mem  128 MB
cache_mgr root@example.com
visible_hostname squids
dns_nameservers 202.103.24.68

论坛徽章:
0
15 [报告]
发表于 2011-05-17 14:17 |只看该作者
回复 1# 12fzm34


   仅仅代理上网么?
把这个改下
# Squid normally listens to port 3128
http_port 8888 vhost vport
改成
http_port 8888

论坛徽章:
0
14 [报告]
发表于 2011-05-16 13:48 |只看该作者
回复 12# 12fzm34


    这个是顺序执行的,我觉得deny all然后再对自己定义的acl做控制比较不会漏,你这里的safe_port应该就不起作用了。。。反正我的就是这样,仅供参考,呵呵。。。
另外建议你装源码的,有些参数要在编译的时候配置,RPM的无法配置,你重做一遍可能就没这些问题了。。。
  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP