#--------------------------------------------------------------------- # Example configuration for a possible web application. See the # full configuration options online. # # http://haproxy.1wt.eu/download/1.4/doc/configuration.txt # #--------------------------------------------------------------------- global log 127.0.0.1 local2 chroot /usr/share/haproxy pidfile /run/haproxy.pid maxconn 4000 user haproxy daemon defaults mode http log global option httplog option dontlognull option http-server-close option forwardfor except 127.0.0.0/8 option redispatch 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 frontend main *:5000 acl url_static path_beg -i /static /images /javascript /stylesheets acl url_static path_end -i .jpg .gif .png .css .js use_backend static if url_static default_backend app frontend http-in bind *:80 default_backend nginx #acl host_new hdr(host) -i new.sinpapel.es acl host_new path_beg -i /owncloud use_backend owncloud if host_new frontend https-in bind *:443 ssl crt /etc/ssl/private/new.sinpapel.es.pem reqadd X-Forwarded-Proto:\ https acl host_new path_beg -i /owncloud use_backend owncloud if host_new default_backend nginx backend static balance roundrobin server static 127.0.0.1:4331 check backend owncloud redirect scheme https if !{ ssl_fc } balance leastconn option httpclose option forwardfor server owncloud 127.0.0.1:8080 maxconn 32 backend nginx #redirect scheme https if !{ ssl_fc } balance leastconn option httpclose option forwardfor server owncloud 127.0.0.1:8000 maxconn 32 backend app balance roundrobin server app1 127.0.0.1:5001 check server app2 127.0.0.1:5002 check server app3 127.0.0.1:5003 check server app4 127.0.0.1:5004 check