CDN是什么?
- CDN是一组分布在多个不同的地理位置的WEB服务器,用于更加有效的向用户发布内容,在优化性能时,会根据距离的远近来选择
- CDN系统能实时的根据网络流量和各节点的连接,负载状况及用户的距离和响应时间等综合信息将用户的请求重新导向离用户最近的服务节点上,其目的是使用户能就近的获取请求数据,解决网络拥堵,提高访问速度,解决由于网络带宽小,用户访问量大,网点分布不均等原因导致的访问速度慢的问题。
- 由于CDN部署在网络运营商的机房,这些运营商又是终端用户网络的提供商,因此用户请求的第一跳就到达CDN服务器,当CDN服务器中缓存有用户请求的数据时,就可以从CDN直接返回给浏览器,因此就可以提高访问速度eal_ip_header
varnish简介
- varnish是一个开源的反向代理软件和HTTP加速器,是一个新贵的缓存软件,与缓存的元老squid相比,varnish更轻量级一些,varnish具有性能更高、速度更快、管理更方便。
一、实验环境
1.实验主机 server1: 172.25.7.2 ##安装配置varnish的主机 真机: 172.25.7.250 ##实验主机 server3: 172.25.7.4 ##实验主机 server4: 172.25.7.5 ##反向代理主机 2.实验环境 <1>server1: http关闭或者http端口修改,不要占用80端口 <2>真机: 安装apache并开启 prot:80 [root@foundation7 ~]# cat /etc/hosts##添加地址解析 172.25.7.2 server1 www.westos.org bbs.westos.org [root@foundation7 ~]# cat /var/www/html/index.html ##开启apache以及编辑index.html www.westos.org www.westos.org <3>server3: 安装nginx并开启 prot:80 [root@server3 ~]# cat /usr/local/nginx/html/index.html bbs.westos.org <4>server4: 安装nginx并开启 prot:80 [root@server4 ~]# cat /usr/local/nginx/html/index.html bbs.westos.org - server4
二、在server1中安装varnish
1.阿里巴巴开源镜像站下载 网址:http://mirrors.aliyun.com/ varnish-4.0.5-1.el7.x86_64.rpm varnish-libs-4.0.5-1.el7.x86_64.rpm jemalloc-3.6.0-1.el7.x86_64.rpm jemalloc-devel-3.6.0-1.el7.x86_64.rpm 2.关闭多余进程 [root@server1 ~]# netstat -antlp Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3280/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3408/master tcp6 0 0 :::22 :::* LISTEN 3280/sshd tcp6 0 0 ::1:25 :::* LISTEN 3408/master 3.安装rpm包,注意安装要在rpm包存在的目录下 [root@server1 ~]# yum install -y varnish-4.0.5-1.el7.x86_64.rpm varnish-libs-4.0.5-1.el7.x86_64.rpm jemalloc-3.6.0-1.el7.x86_64.rpm jemalloc-devel-3.6.0-1.el7.x86_64.rpm 3.开启varnish [root@se