From 54f4c4b11d2b902efdf256c7ea2302aece27f0db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Sat, 24 Oct 2015 17:16:59 +0200 Subject: [PATCH] --- haproxy.cfg | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 haproxy.cfg diff --git a/haproxy.cfg b/haproxy.cfg new file mode 100644 index 0000000..b1551f4 --- /dev/null +++ b/haproxy.cfg @@ -0,0 +1,80 @@ +#--------------------------------------------------------------------- +# 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 \ No newline at end of file