CDN :
 CDN的全称是Content Delivery Network,即内容分发网络。其基本思路是尽可能避开互联网上有可能影响数据传输速度和稳定性的瓶颈和环节,使内容传输的更快、更稳定。通过在网络各处放置节点服务器所构成的在现有的互联网基础之上的一层智能虚拟网络,CDN系统能够实时地根据网络流量和各节点的连接、负载状况以及到用户的距离和响应时间等综合信息将用户的请求重新导向离用户最近的服务节点上。其目的是使用户可就近取得所需内容,解决 Internet 网络拥挤的状况,提高用户访问网站的响应速度。
 
 缓存 服务器
都是静态的 的网站
三个软件
解决方案:
1.squid 正反向代理 都可以
         并发不能超过 1000
2. Varnish:16G 使用内存缓存,提高服务器性能 
3. nginx:并发能力达到 30000 ,
  动态:php 达到并发500 ,加缓存可以提高 ,并发能力
 从某种意义上,代理服务器也是防火墙,它能实现规则,工作在应用层
 
Nginx:配置
作为 web 服务器来装 1.1.3版本
[root@node2 ~]# yum - y groupinstall "Development Tools" "Development Libraries"
 
 下载软件包:
最新版本 get nginx-1.1.3.tar.gz
 
[root@node2 ~]# tar nginx-1.1.3.tar.gz
[root@node2 ~]# hwclock -s
[root@node2 ~]# tar xf nginx-1.1.3.tar.gz
[root@node2 ~]#yum list all
 [root@node2 ~]# groupadd nginx
[root@node2 ~]# useradd -g nginx -s /bin/false -M nginx
#cd nginx-1.1.3
[root@node2 nginx-1.1.3]# yum -y install pcre-devel
./configure \
 --prefix=/usr \
 --sbin-path=/usr/sbin/nginx \
 --conf-path=/etc/nginx/nginx.conf \
 --error-log-path=/var/log/nginx/error.log \
 --http-log-path=/var/log/nginx/access.log \
 --pid-path=/var/run/nginx/nginx.pid \
 --lock-path=/var/lock/nginx.lock \
 --user=nginx \
 --group=nginx \
 --with-http_ssl_module \
 --with-http_flv_module \
 --with-http_stub_status_module \
 --with-http_gzip_static_module \
 --http-client-body-temp-path=/var/tmp/nginx/client/ \
 --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
 --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
 --with-pcre
#make && make install
[root@node2 nginx-1.1.3]# cd
[root@node2 ~]# vim /etc/init.d/nginnx 一下可以复制
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig:    - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
#                proxy and IMAP/POP3 proxy server
# processname: nginx
# config:       /etc/nginx/nginx.conf
# config:       /etc/sysconfig/nginx
# pidfile:      /var/run/nginx.pid
 
# Source function library.
. /etc/rc.d/init.d/functions
 
# Source networking configuration.
. /etc/sysconfig/network
 
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
 
nginx="/usr/sbin/nginx"
prog=$(basename $nginx)
 
NGINX_CONF_FILE="/etc/nginx/nginx.conf"
 
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
 
lockfile=/var/lock/subsys/nginx
 
make_dirs() {
   # make required directories
   user=`nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
   options=`$nginx -V 2>&1 | grep 'configure arguments:'`
   for opt in $options; do
       if [ `echo $opt | grep '.*-temp-path'` ]; then
           value=`echo $opt | cut -d "=" -f 2`
           if [ ! -d "$value" ]; then
               # echo "creating" $value
               mkdir -p $value && chown -R $user $value
           fi
       fi
   done
}
 
start() {
    [ -x $nginx ] || exit 5
    [ -f $NGINX_CONF_FILE ] || exit 6
    make_dirs
    echo -n $"Starting $prog: "
    daemon $nginx -c $NGINX_CONF_FILE
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}
 
stop() {
    echo -n $"Stopping $prog: "
    killproc $prog -QUIT
    retval=$?
     echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}
 
restart() {
    configtest || return $?
    stop
    sleep 1
    start
}
 
reload() {
    configtest || return $?
    echo -n $"Reloading $prog: "
    killproc $nginx -HUP
    RETVAL=$?
    echo
}
 
force_reload() {
    restart
}
 
configtest() {
 $nginx -t -c $NGINX_CONF_FILE
}
 
rh_status() {
    status $prog
}
 
rh_status_q() {
    rh_status >/dev/null 2>&1
}
 
case "$1" in
    start)
        rh_status_q && exit 0
        $1
        ;;
    stop)
        rh_status_q || exit 0
        $1
        ;;
    restart|configtest)
        $1
        ;;
    reload)
        rh_status_q || exit 7
        $1
        ;;
    force-reload)
        force_reload
        ;;
    status)
        rh_status
        ;;
    condrestart|try-restart)
        rh_status_q || exit 0
            ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
        exit 2
esac
 
[root@node2 ~]# chmod +x !$
root@node2 ~]# chkconfig --add nginx
[root@node2 ~]# service nginx start
/etc/init.d/nginx: line 1: nx: command not found
Starting nginx:                                             [ OK ]
[root@node2 ~]#
 
然后再 浏览器上输入 主机地址
 
[root@node2 ~]# cd /etc/nginx/
 
[root@node2 nginx]# cp nginx.conf nginx.conf.bak 先把 主配置文件 复制一份
 
[root@node2 nginx]# vim nginx.conf
events {
    worker_connections 1024;   允许多少个 用户同时登录进来 可以改大一点 5024
location / {
            root   html;   指的是网页存放位置
            index index.html index.htm;
        }
#cd /usr/html     查看网页内容
#vim index.html
 
[root@node2 nginx]# service nginx restart
[root@node2 nginx]# yum install httpd
 
 
[root@node2 nginx]# chkconfig httpd off 开机不让自动启动
 
[root@node2 nginx]# ab -n 1000 -c 100 http://192.168.0.188/index.html 做一下压力测试
 
做别名 访问:
[root@node2 nginx]# vim nginx.conf
        location / {
            root   html; 把 html 改为 /web;
            index index.html index.htm;
        }
 
[root@node2 nginx]# mkdir /web
[root@node2 nginx]# vim /web/index.html
 Suibian shuru
 
在 浏览器 刷新 一下
 
[root@node2 nginx]# vim nginx.conf
 
 
location / {
            root /web;
            index index.html index.htm;
        }
        location /bbs {
          root /web;
           }
[root@node2 nginx]# mkdir /bbs
[root@node2 nginx]# vim /bbs/test.html
[root@node2 nginx]# service nginx restart