Chinaunix首页 | 论坛 | 博客
  • 博客访问: 63985
  • 博文数量: 14
  • 博客积分: 306
  • 博客等级: 二等列兵
  • 技术积分: 135
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-24 15:02
文章分类
文章存档

2012年(14)

我的朋友

分类: LINUX

2012-07-18 11:58:06

---多域名---开始-------
global
        maxconn 5120
        chroot /usr/local/haproxy
        uid 992
        gid 992
        daemon
        quiet
        nbproc  2
        pidfile /usr/local/haproxy/haproxy8080.pid
defaults
        log     global
        option forwardfor
        mode    http
        option  httplog
        option  dontlognull
        log 127.0.0.1 local3
        retries 3
        option redispatch
        option httpchk GET /?Command=0x00000000 HTTP/1.1
        maxconn 2000
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000
frontend  http-in
        bind 0.0.0.0:8080
        mode http
        log global
        option httplog
        option httpclose
        option forwardfor
        acl is_A hdr_beg(host) -i 域名A
        acl is_B hdr_beg(host) -i 域名B
       
        use_backend AAAAAAA if is_A
        use_backend BBBBBBB if is_B
       
        backend AAAAAAA
        mode http
        balance roundrobin
        server emas1 127.0.0.1:8081 weight 100
        backend BBBBBBB 
        mode http
        balance roundrobin
        server ganji1 127.0.0.1:8082 weight 100
----多域名--结束--------------

----一个域名----目录分开-----开始---------------
global
        log 127.0.0.1 local0 info
        maxconn 5120
        chroot /usr/local/haproxy
        uid 992
        gid 992
        daemon
        quiet
        nbproc  2
        pidfile /usr/local/haproxy/haproxy993.pid
defaults
        option forwardfor
        mode    http
        option  httplog
        option  dontlognull
        log 127.0.0.1 local0 info
        retries 3
        option redispatch
        option httpchk GET /?Command=0x00000000 HTTP/1.1
        maxconn 2000
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000
frontend  http-in
        bind 0.0.0.0:80
        mode http
        log global
        option http-server-close
        option forwardfor header X-Real-IP    ###让后台服务看到真实IP地址
        acl stat_req_1 path_beg /目录1/
        acl stat_req_2 path_beg /目录2/
        #block if !stat_req_1 || stat_req_2
        use_backend app1_server if stat_req_1
        use_backend app2_server if stat_req_2
        #default_backend   app1_server
        backend app1_server
        mode http
        balance roundrobin
        server s1_01 192.168.2.109:81 weight 100
        server s1_02 192.168.2.109:82 weight 100
        server s1_03 192.168.2.109:83 weight 100
        backend app2_server
        mode http
        balance roundrobin
        server s2_01 192.168.2.109:84 weight 100      
        server s2_02 192.168.2.109:85 weight 100
        server s2_03 192.168.2.109:86 weight 100
listen stats :4082
       mode http
       transparent
       stats uri / haproxy-stats
       stats realm Haproxy \ statistic
       stats auth admin:密码
----一个域名----目录分开-----结束---------------
阅读(2010) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~