squid反向代理

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

squid反向代理

搭建网络环境如下拓扑图

说明:

1.配置squid反向代理服务器保护内网服务器、缓存静态页面提高服务器的响应速度

2.环境:centos6.5

1.配置squid服务器网卡:

内网:10.0.0.1/8外网20.0.0.1/8

内网网卡:

[root@bogon~]#cd/etc/sysconfig/network-scripts

[root@bogon network-scripts]#

ls

ifcfg-Auto_eth1

[root@bogon~]#ifconfig

1

------------------南阳理工学软件学院网趣社团

------------------南阳理工学软件学院网趣社团

2

2.web1网络配置

[root@bogon ~]#cd /etc/sysconfig/network-scripts

[root@bogon network-scripts]#ls

[root@bogon network-scripts]#vi ifcfg-Auto_eth1

ip 地址10.0.0.2/8网关10.0.0.1

Web2服务器配置如同web1

3.配置外网pc 客户端

设置ip 地址为20.0.0.2/8网关为20.0.0.1

一、web 服务器设置

查看本地是否安装htppd 服务

[root@bogon network-scripts]#rpm -qa grep |httpd

若没有此服务请切换至关盘目录查找squid rpm 包进行安装

[root@bogon network-scripts]#cd /media/CentOS_6.5_Final/Packages/

[root@bogon Packages]#find /-name http*.rpm

[root@bogon Packages]#rpm -ivh httpd-2.2.15-29.el6.centos.i686.rpm

重启htppd

服务

关闭防火墙

#/etc/init.d/iptables stop

修改Web Server 主页

Web1:

#echo "

Squid-Web1/10.0.0.2

">/var/www/html/index.html

Web2服务器配置如上

二、配置squid 服务器

http_port80accel vhost

http_access allow all

cache_peer10.0.0.2parent800originserver round-robin weight=1 cache_peer10.0.0.3parent800originserver round-robin weight=1 cache_peer_domain www www.squid.dev

cache_peer_domain bbs bbs.squid.dev

visible_hostname

cache_mgr

1096461149

@

重启squid服务

若squid启动失败,因为上面设定了squid的监听端口是80,和系统的http服务冲突,所以要将http服务停掉

三、测试

在pc端输入代理服务器的ip地址10.0.0.1不断刷新浏览器可以看见web1、web2两个不同界面

在web1上查看日志

------------------南阳理工学软件学院网趣社团

3

[root@localhost htppd]#cd/var/log/httpd/

access_log

[root@localhost httpd]#tail

[root@localhost/]#service httpd restart

停止httpd:[失败]

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

(98)Address already in use:make_sock:could not bind to address[::]:80

(98)Address already in use:make_sock:could not bind to address0.0.0.0:80

no listening sockets available,shutting down

Unable to open logs

[失败]

解决方案:

进入apache的安装目录:/usr/local/apache/conf

编辑:httpd.conf

将里面的#ServerName localhost:80注释去掉即可。

再执行httpd

vi/etc/selinux/config

4

------------------南阳理工学软件学院网趣社团

相关文档
最新文档