squid实现反向代理!!!


项目实施者:付炜超

项目背景:

我们公司内部的服务器想要外面的人可以访问,而且想要在保证自己服务器的安全性。




实验环境:

vmware workstation 11

centos6.5的系统下  

web服务器:    ip 192.168.239.134 防火墙关闭 setenforce 0

反向代理服务器  ip 192.168.239.133  防火墙关闭 setenforce 0

SecureCRT (ssh远程连接软件)


架构图:

wKioL1dgr8ngBrzbAAEukdg37Z0784.jpg-wh_50




实验流程

一、真实服务器web服务安装

yum install -y http


二、web服务启动

[root@localhost ~]# rpm -q httpd    #查看WEB服务软件是否成功安装

httpd-2.2.15-47.el6.centos.4.x86_64

[root@localhost ~]# service httpd start

Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName

[  OK  ]


三、反向代理服务器上squid软件安装

[root@localhost ~]# yum install -y squid


四、对/etc/squid/squid.conf进行配置

1、把缓存功能打开

# Uncomment and adjust the following to add a disk cache directory.

cache_dir ufs /var/spool/squid 100 16 256    #这一行的注释拿掉


2、反向代理设置   在配置文件最下面加上这三行

http_port 80 accel vhost vport

cache_peer 192.168.239.134 parent 80 0    #192.168.239.134 是真实web服务器的ip

http_access allow all


3、squid服务启动

[root@localhost squid]# service squid restart

Stopping squid: 2016/05/06 03:32:12| WARNING cache_mem is larger than total disk cache space!

................[  OK  ]

init_cache_dir /var/spool/squid... Starting squid: .[  OK  ]

五、测试:

1、创建测试页 (在真实的web服务器上进行)

[root@localhost conf]# echo "192.168.239.134" >/var/www/html/index.html


2、访问反向代理服务器的ip

wKiom1csBu7gRCslAAB6henpYgs041.png



项目总结:我的风格,用最简洁的文字来展示复杂的技术。希望大家都有所得


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值