一、 安装第一台节点服务器
1. 安装nginx依赖程序
[root@centos06 ~]

2. 释放nginx归档文件
[root@centos06 ~]

3. 创建管理nginx用户
[root@centos06 ~]

4. 配置nginx
[root@centos06 ~]
[root@centos06 nginx-1.6.0]

5. 编译安装nginx
[root@centos06 nginx-1.6.0]

6. 优化命令,设置网站根目录
[root@centos06 ~]
[root@centos06 ~]

7. 启动服务监听端口
[root@centos06 ~]
[root@centos06 ~]

二、 安装第二胎节点服务器
1. 安装依赖程序
[root@centos07 ~]

2. 释放nginx归档文件
[root@centos07 ~]

3. 创建管理nginx账户
[root@centos07 ~]

4. 配置nginx
[root@centos07 ~]
[root@centos07 nginx-1.6.0]

5. 编译安装nginx
[root@centos07 nginx-1.6.0]

6. 优化命令,创建网站根目录
[root@centos07 ~]
[root@centos07 ~]

7. 启动服务监听端口
[root@centos07 ~]
[root@centos07 ~]

三、 安装haproxy
1. 安装haproxy依赖程序
[root@centos08 ~]

2. 释放haproxy归档文件
[root@centos08 ~]

3. 配置安装haproxy
[root@centos08 haproxy-1.4.24]

4. 生成主配置文件
[root@centos08 haproxy-1.4.24]
[root@centos08 haproxy-1.4.24]

5. 优化命令
[root@centos08 haproxy-1.4.24]

6. 生成服务配置文件
[root@centos08 haproxy-1.4.24]
[root@centos08 haproxy-1.4.24]

7. 添加系统服务设置开机启用

8. 修改haproxy主配置文件
[root@centos08 ~]
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
chroot /usr/share/haproxy
uid 99
gid 99
daemon
defaults
log global
mode http
option httplog
option dontlognull
retries 3
redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen appli1-rewrite 192.168.100.80:80
cookie SERVERID rewrite
balance roundrobin
server app1_1 192.168.100.60:80 check inter 2000 rise 2 fall 5
server app1_2 192.168.100.70:80 check inter 2000 rise 2 fall 5
option checkcache /index.html
9. 创建服务启动临时目录
[root@centos08 ~]

10. 启动服务,监听端口
[root@centos08 ~]
[root@centos08 ~]

四、 客户端进行测试
1. 访问192.168.100.80

2. 停止192.168.100.60,网站服务器
[root@centos06 ~]
[root@centos06 ~]

3. 再进行测试(访问出现test02,使用第二台节点服务器)
