Skip to content

Instantly share code, notes, and snippets.

@paulmars
Created November 29, 2012 06:20
Show Gist options
  • Select an option

  • Save paulmars/4167127 to your computer and use it in GitHub Desktop.

Select an option

Save paulmars/4167127 to your computer and use it in GitHub Desktop.
Haproxy (two domains, two servers)
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#chroot /usr/share/haproxy
user haproxy
group haproxy
daemon
#debug
#quiet
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
frontend http_proxy
bind *:80
acl is_bar hdr_dom(host) -i socialmoth.com
acl is_foo hdr_dom(host) -i junojs
use_backend cluster1 if is_bar
use_backend cluster2 if is_foo
default_backend cluster2
backend cluster1
server server1 127.0.0.1:3000
backend cluster2
server server2 127.0.0.1:2200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment