部署和调优 2.2 squid反向代理

配置反向代理

打开配置文件

vim /etc/squid/squid.conf

修改

http_port 3128 改为 http_port 80 accel vhost vport

在它下面添加一段

cache_peer 115.239.210.27 parent 80 0 originserver name=a
cache_peer_domain a www.qq.com
cache_peer 114.80.143.158 parent 80 0 originserver name=b
cache_peer_domain b www.163.com

查看配置文件是否错误

squid -kch

 

重新加载

squid -kre

 

浏览器查看

把正向代理关掉

工具-internet选项-连接-局域网设置-关掉为LAN使用代理服务器

 

打开hosts

C:\Windows\System32\drivers\etc\HOSTS 记事本打开

添加一行

192.168.1.117 www.qq.com www.163.com

 

在浏览器打开这两个网站可以访问,打开其他网站不可访问

 

posted @ 2015-12-19 23:47  dennyLinux  阅读(192)  评论(0编辑  收藏  举报