全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 7118|回复: 17

centos vps架设简单的squid反向代理服务器

[复制链接]
发表于 2010-8-12 16:05:07 | 显示全部楼层 |阅读模式
先去掉apache
  1. yum -y remove httpd
复制代码
然后下载安装squid3.0
  1. wget http://people.redhat.com/jskala/squid/squid-3.0.STABLE25-1.el5/i386/squid-3.0.STABLE25-1.el5.i386.rpm
  2. rpm -i squid-3.0.STABLE25-1.el5.i386.rpm
复制代码
修改配置文件/etc/squid/squid.conf的内容为
  1. acl localhost src 127.0.0.1/255.255.255.255
  2. acl to_localhost dst 127.0.0.0/8

  3. http_port 80 vhost

  4. cache_peer 你的上级web服务器的ip parent 80 0 no-query originserver name=yourfirstdomain.com
  5. cache_peer_domain yourfirstdomain.com .yourfirstdomain.com
  6. cache_peer 你的上级web服务器的ip parent 80 0 no-query originserver name=yourotherdomain.com
  7. cache_peer_domain yourotherdomain.com .yourotherdomain.com


  8. http_access allow all

  9. cache_mem 64 MB
  10. emulate_httpd_log on
  11. visible_hostname buyvmvps
  12. cache_mgr webmaster@example.com
  13. access_log /var/log/squid/access.log squid
  14. refresh_pattern .               0       20%     4320
  15. acl apache rep_header Server ^Apache
  16. coredump_dir /var/spool/squid
复制代码
设置开机启动,启动squid
  1. chkconfig --level 2345 squid on
  2. service squid start
复制代码

评分

参与人数 1威望 +5 收起 理由
cuxian + 5 真应要求给教程了,谢谢!

查看全部评分

发表于 2010-8-12 16:21:28 | 显示全部楼层
反向代理最近好像很时髦,有机会试一下
发表于 2010-8-12 16:28:42 | 显示全部楼层
不错。收藏了
发表于 2010-8-12 20:26:39 | 显示全部楼层
楼主是转载的,还是实测过的?
 楼主| 发表于 2010-8-12 20:40:46 | 显示全部楼层
实际安装后整理的步骤
发表于 2010-8-12 20:54:14 | 显示全部楼层
谢谢!等一下试试看!
发表于 2010-8-12 20:58:10 | 显示全部楼层
可惜squid不支持smp,acl多了,流量大了后CPU占用比较厉害,不过做为反向代理还是很不错的。
另外一个不错的选择就是nginx
发表于 2010-8-12 21:14:28 | 显示全部楼层
貌似不够详细啊,,,可能是我太小白了
发表于 2010-8-13 02:27:02 | 显示全部楼层
收藏 接下来 怎么新建反向代理?
发表于 2010-8-15 15:11:23 | 显示全部楼层
弄下来只是访问主页有代理么
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-3-29 23:14 , Processed in 0.073901 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表