Centos 編譯安裝Haproxy

來源:互聯網
上載者:User

標籤:

一.環境介紹

  1.Centos6

  2. haproxy-1.4.25.tar.gz

 

二.安裝

$ curl -O http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.25.tar.gz$ tar zxvf haproxy-1.4.25.tar.gz$ cd haproxy-1.4.25$ make TARGET=linux26 PREFIX=/usr/local/haproxy$ make install PREFIX=/usr/local/haproxy$ cp examples/haproxy.cfg /usr/local/haproxy/$ cp examples/haproxy.init /etc/init.d/haproxy$ chmod 755 /etc/init.d/haproxy$ ln -s /usr/local/haproxy /etc/$ ln -s /usr/local/haproxy/sbin/haproxy /usr/sbin/$ groupadd haproxy$ useradd -g haproxy haproxy -s /sbin/nologin -M$ grep haproxy /etc/passwdhaproxy:x:507:507::/home/haproxy:/sbin/nologin

 

 

三.配置

$ vi /etc/haproxy/haproxy.cfgglobal    log 127.0.0.1    local0    log 127.0.0.1    local1 notice    #log loghost    local0 info    maxconn 40960    chroot /usr/local/haproxy    uid 803    gid 803    daemon    nbproc 1    #debug    #quietdefaults    log    global    mode    http    option    httplog    option    dontlognull    option  forwardfor    option  httpclose    retries    3    option  redispatch    maxconn    2000    timeout connect 500000    timeout client  5000000    timeout server  50000000frontend http-in    bind    192.168.233.2:80    mode    http    option  httplog    log     global    acl is_a hdr_beg(host) -i www.test.com    acl is_a hdr_beg(host) -i test.com    use_backend a_server if is_a    stats enable    stats hide-version    stats uri     /admin-status    stats auth    admin:admin123    stats admin if TRUE        backend a_server    balance roundrobin    cookie  SESSION_COOKIE  insert indirect nocache    option  httpchk HEAD /Default.aspx HTTP/1.0    fullconn 10000    server web58 192.168.233.158:80 minconn 100 maxconn 1000 cookie web1 weight 6 check inter 2000 rise 2 fall 4    server web85 192.168.233.185:80 minconn 100 maxconn 1000 cookie web2 weight 6 check inter 2000 rise 2 fall 4

 

  

 

四.啟動

/etc/init.d/haproxy start

 

  

Centos 編譯安裝Haproxy

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.