Skip to content

Instantly share code, notes, and snippets.

@guysoft
Last active December 9, 2018 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guysoft/036cca7b39726613d76144fdad62b8a6 to your computer and use it in GitHub Desktop.
Save guysoft/036cca7b39726613d76144fdad62b8a6 to your computer and use it in GitHub Desktop.
# Example configuration file for HAProxy 1.3, refer to the url below for
# a full documentation and examples for configuration:
# http://haproxy.1wt.eu/download/1.3/doc/configuration.txt
# Global parameters
global
# Log events to a remote syslog server at given address using the
# specified facility and verbosity level. Multiple log options
# are allowed.
#log 10.0.0.1 daemon info
# Specifiy the maximum number of allowed connections.
maxconn 32000
# Raise the ulimit for the maximum allowed number of open socket
# descriptors per process. This is usually at least twice the
# number of allowed connections (maxconn * 2 + nb_servers + 1) .
ulimit-n 65535
# Drop privileges (setuid, setgid), default is "root" on OpenWrt.
uid 0
gid 0
# Perform chroot into the specified directory.
#chroot /var/run/haproxy/
# Daemonize on startup
daemon
nosplice
# Enable debugging
#debug
# Spawn given number of processes and distribute load among them,
# used for multi-core environments or to circumvent per-process
# limits like number of open file descriptors. Default is 1.
#nbproc 2
backend mediagoblin
mode http
timeout connect 10s
timeout server 30s
balance roundrobin
server mediagoblin1 10.81.2.91:80 weight 1 maxconn 100
backend mediagoblin_https
mode tcp
timeout connect 10s
timeout server 30s
balance roundrobin
server mediagoblin1 10.81.2.91:443 weight 1 maxconn 100
backend space
mode http
timeout connect 5s
timeout server 5m
balance roundrobin
# points for effort?
#reqrep ^GET\ /\ HTTP/1.1 GET\ /space.html\ HTTP/1.1
#reqrep ^GET\ /index.html\ HTTP/1.1 GET\ /space.html\ HTTP/1.1
server space1 127.0.0.1:1080 weight 1 maxconn 100
backend webcam
mode http
timeout connect 5s
timeout server 5m
balance roundrobin
server webcam1 10.81.2.80:8081 weight 1 maxconn 100
backend yacy
mode http
timeout connect 5s
timeout server 5m
balance roundrobin
server yacy1 10.81.2.91:8090 weight 1 maxconn 100
backend yacy_tcp
mode tcp
timeout connect 5s
timeout server 5m
balance roundrobin
server yacy1 10.81.2.91:8090 weight 1 maxconn 100
backend etherpad
mode tcp
timeout connect 5s
timeout server 5m
balance roundrobin
server etherpad1 10.81.2.91:9001 weight 1 maxconn 100
frontend http_proxy #arbitrary name for the frontend
bind *:80 #all interfaces at port 80
mode http
timeout client 1m
#header x-haproxy-forwarded-for
option forwardfor
option http-server-close
option http-pretend-keepalive
default_backend mediagoblin
acl req_mediagoblin hdr_beg(host) mediagoblin.
acl req_mediagoblin hdr_beg(host) mail.
acl req_mediagoblin hdr_beg(host) lists.
acl req_search hdr_beg(host) search.
acl req_telavivmakers hdr(host) tami.org.il
acl req_webcam path_beg /webcam
# redirect permanently (code 301)
redirect location http://telavivmakers.org/ code 301 if req_telavivmakers
use_backend webcam if req_webcam
## NOTE: The redirect lines below should be used when mail is down for maintenance.
use_backend mediagoblin if req_mediagoblin
use_backend yacy if req_search
#redirect location http://space.telavivmakers.org/down_for_maint.html code 302 if req_mediagoblin
#redirect location http://space.telavivmakers.org/down_for_maint.html code 302 if req_search
#redirect location http://space.telavivmakers.org/down_for_maint.html code 302 if req_tamigraph
acl host_space hdr_beg(host) space.
use_backend space if host_space
frontend https_proxy #arbitrary name for the frontend
bind *:443
mode tcp
#default_backend etherpad
default_backend mediagoblin_https
timeout client 1m
acl host_etherpad hdr_beg(host) etherpad.
use_backend etherpad if host_etherpad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment