免费注册 查看新帖 |

Chinaunix

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

squid3反向代 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-12-10 10:42 |只看该作者 |倒序浏览
此例中webserver使用apache2,监听地址为127.0.0.1 端口为80 squid使用外网地址也是监听端口
机制如 用户浏览器–>squid监听的外网地址–>127.0.0.1:80
1.下载软件squid3.0 (开发版本正式版本为squid2.6)
wget
ftp://ftp.cuhk.edu.hk/pub/packag ... quid-3.0.RC1.tar.gz
2.编译安装 (把squid安装在/usr/local/squid3.0这个目录中)
tar -zxvf squid-3.0.RC1.tar.gz
cd squid-3.0.RC1
./configure –prefix=/usr/local/squid3.0/ –disable-internal-dns –with-default-user=squid –enable-storeio=”aufs,coss,diskd,ufs” –with-pthreads
make
make install
make clean all
3.创建squid组及用户 并将/usr/local/squid/var 属主改为squid
groupadd squid
useradd -G squid -s /sbin/nologin squid
chown -R squid:squid /usr/local/squid3.0/var
4.修改配置文件/usr/local/squid3.0/squid.conf
首先做一个备份
然后再编辑
修改http_port选项为
http_port xxx.xxx.xxx.xxx:80 vhost vport(xxx.xxx.xxx.xxx为您的IP地址)
再将
# http_access deny all
修改为
http_access allow all
再添加
cache_peer 127.0.0.1 parent 80 0 no-query originserver
visible_hostname test(这个test为主机名)

# cache_effective_user nobody 改成cache_effective_user squid
增加cache_effective_group squid
5.初始化squid 建立cache目录并启动squid
/usr/local/squid3.0/sbin/squid -z 建立cache
/usr/local/squid3.0/sbin/squid -NCd1 &启动squid

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/71107/showart_2116162.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP