1. 根据架构选择适当的编译参数
    $ mkdir /usr/local/haproxy
    
    #如果是32位:
    $ make TARGET=linux26 CPU=i686 USE_STATIC_PCRE=1 PREFIX=/usr/local/haproxy
    
    #如果是64位:
    $ make PREFIX=/usr/local/haproxy TARGET=linux26 ARCH=x86_64 USE_STATIC_PCRE=1
    $ make install PREFIX=/usr/local/haproxy
    
  2. 创建用户haproxy
    $ groupadd -g 501 haproxy
    $ useradd -u 501 -g 501 haproxy
    $ id haproxy
    uid=98(haproxy) gid=98(haproxy) groups=98(haproxy)
    
  3. 常见配置目录
    $ mkdir -p /usr/local/haproxy/conf/
    $ mkdir -p /usr/local/haproxy/logs
    $ mkdir -p /usr/local/haproxy/run
    
  4. 编辑配置文件
    $ vi /usr/local/haproxy/conf/haproxy.cfg
    global
    log         127.0.0.1 local2
    chroot      /usr/local/haproxy
    pidfile     /usr/local/haproxy/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon
    stats socket /usr/local/haproxy/stats
    defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    option                  abortonclose
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000
    listen stats
    mode          http
    bind          *:8080
    stats         enable
    stats         hide-version
    stats uri     /haproxyadmin?stats
    stats realm   Haproxy\ Statistics
    stats auth    admin:admin
    stats admin if TRUE
    frontend webservers
    bind         *:80
    mode         http
    log          global
    option       httpclose
    option       logasap
    option       dontlognull
    #################HAProxy的日志记录内容设置###################
    capture request  header Host len 20
    capture request  header X-Forwarded-For len 15
    capture request  header Referer len 60
    ################url_static配合if使用实现动静分#########################
    acl url_static       path_beg       -i /static /images /javascript /stylesheets
    acl url_static       path_end       -i .html .jpg .jpeg .gif .png .css .js
    use_backend static_servs          if url_static
    default_backend dynamic_servs
    
    backend static_servs
    balance roundrobin
    server static1 192.168.121.213:80 check maxconn 6000
    server static2 192.168.121.214:80 check maxconn 6000
    backend dynamic_servs
    balance source
    hash-type consistent
    server dynamic1 192.168.121.213:80 check maxconn 1000
    server dynamic2 192.168.121.214:80 check maxconn 1000
    
  5. 配置启动文件
    $ cp /usr/local/haproxy/sbin/haproxy /etc/init.d/haproxy
    $ chmod 755 /etc/init.d/haproxy  
    $ /etc/init.d/haproxy -f /usr/local/haproxy/conf/haproxy.cfg 
    

2 条评论

max789club · 2026-08-17 18:32

Finally found a spot where the VIP program actually rewards loyal players instead of just taking their money. The monthly tournaments are competitive and the prizes are fair. My account management dashboard makes tracking progress really easy. Will definitely stick around. max789club

mybigwin888 · 2026-08-17 18:32

The slot selection here keeps me coming back every single day. I actually snagged a nice payout on my first weekend and the payout speed was exactly what I hoped for. Such a fun vibe to explore new titles and chase those big moments. mybigwin888

发表回复

Avatar placeholder

您的邮箱地址不会被公开。 必填项已用 * 标注