"Fossies" - the Fresh Open Source Software Archive

Member "haproxy-2.0.0/examples/content-sw-sample.cfg" (16 Jun 2019, 2499 Bytes) of package /linux/misc/haproxy-2.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #
    2 # This is a sample configuration. It illustrates how to separate static objects
    3 # traffic from dynamic traffic, and how to dynamically regulate the server load.
    4 #
    5 # It listens on 192.168.1.10:80, and directs all requests for Host 'img' or
    6 # URIs starting with /img or /css to a dedicated group of servers. URIs
    7 # starting with /admin/stats deliver the stats page.
    8 #
    9 
   10 global
   11         maxconn         10000
   12         stats socket    /var/run/haproxy.stat mode 600 level admin
   13         log             127.0.0.1 local0
   14         uid             200
   15         gid             200
   16         chroot          /var/empty
   17         daemon
   18 
   19 # The public 'www' address in the DMZ
   20 frontend public
   21         bind            192.168.1.10:80 name clear
   22         #bind            192.168.1.10:443 ssl crt /etc/haproxy/haproxy.pem
   23         mode            http
   24         log             global
   25         option          httplog
   26         option          dontlognull
   27         monitor-uri     /monitoruri
   28         maxconn         8000
   29         timeout client  30s
   30 
   31         stats uri       /admin/stats
   32         use_backend     static if { hdr_beg(host) -i img }
   33         use_backend     static if { path_beg /img /css   }
   34         default_backend dynamic
   35 
   36 # The static backend backend for 'Host: img', /img and /css.
   37 backend static
   38         mode            http
   39         balance         roundrobin
   40         option prefer-last-server
   41         retries         2
   42         option redispatch
   43         timeout connect 5s
   44         timeout server  5s
   45         option httpchk  HEAD /favicon.ico
   46         server          statsrv1 192.168.1.8:80 check inter 1000
   47         server          statsrv2 192.168.1.9:80 check inter 1000
   48 
   49 # the application servers go here
   50 backend dynamic
   51         mode            http
   52         balance         roundrobin
   53         retries         2
   54         option redispatch
   55         timeout connect 5s
   56         timeout server  30s
   57         timeout queue   30s
   58         option httpchk  HEAD /login.php
   59         cookie          DYNSRV insert indirect nocache
   60         fullconn        4000 # the servers will be used at full load above this number of connections
   61         server          dynsrv1 192.168.1.1:80 minconn 50 maxconn 500 cookie s1 check inter 1000
   62         server          dynsrv2 192.168.1.2:80 minconn 50 maxconn 500 cookie s2 check inter 1000
   63         server          dynsrv3 192.168.1.3:80 minconn 50 maxconn 500 cookie s3 check inter 1000
   64         server          dynsrv4 192.168.1.4:80 minconn 50 maxconn 500 cookie s4 check inter 1000
   65