global maxconn 10000 user haproxy group haproxy daemon ca-base /srv/newsblur/config/certificates crt-base /srv/newsblur/config/certificates log 127.0.0.1 local0 notice # log 127.0.0.1 local1 info defaults log global maxconn 10000 mode http option forwardfor header X-Real-IP option http-server-close # option log-health-checks option log-separate-errors option httplog option redispatch option abortonclose timeout connect 5s timeout client 30s timeout server 30s timeout tunnel 1h retries 3 errorfile 502 /srv/newsblur/templates/502.http errorfile 503 /srv/newsblur/templates/502.http errorfile 504 /srv/newsblur/templates/502.http frontend public bind :80 bind :443 ssl crt newsblur.pem option http-server-close # Redirect all HTTP traffic to HTTPS # redirect scheme https if !{ ssl_fc } acl mx_mode nbsrv(maintenance) lt 1 acl gunicorn_dead nbsrv(gunicorn) lt 1 acl nginx_dead nbsrv(nginx) lt 1 monitor-uri /status monitor fail if mx_mode monitor fail if gunicorn_dead monitor fail if nginx_dead use_backend node_socket if { path_beg /socket.io/ } use_backend node_favicon if { path_beg /rss_feeds/icon } use_backend nginx if { path_beg /media/ } use_backend nginx if { path_beg /static/ } use_backend nginx if { path_beg /favicon } use_backend nginx if { path_beg /crossdomain/ } use_backend nginx if { path_beg /robots } use_backend nginx if { path_beg /munin/ } use_backend nginx if mx_mode use_backend gunicorn_counts if { path_beg /reader/feed_unread_count } use_backend gunicorn unless gunicorn_dead || nginx_dead backend node_socket balance roundrobin server nodedebug 127.0.0.1:8888 check inter 2000ms backend node_favicon balance roundrobin server nodedebug 127.0.0.1:81 check inter 2000ms backend nginx balance roundrobin option httpchk GET /_nginxchk http-check expect rstatus 200|503 server nginxdebug 127.0.0.1:81 check inter 2000ms backend gunicorn balance roundrobin option httpchk GET /_haproxychk server gunicorndebug 127.0.0.1:8000 check inter 2000ms backend gunicorn_counts balance roundrobin server gunicorndebug 127.0.0.1:8000 check inter 2000ms backend maintenance option httpchk HEAD /maintenance HTTP/1.1\r\nHost:\ www http-check expect status 404 http-check send-state server nginxdebug 127.0.0.1:81 check inter 2000ms frontend stats bind :1936 ssl crt newsblur.pem default_backend stats backend stats stats enable stats hide-version stats realm Haproxy\ Statistics stats uri / stats auth sclay:password stats refresh 15s