Created
February 23, 2015 11:21
-
-
Save phillipkent/ab069a2cb6a175543fde to your computer and use it in GitHub Desktop.
Example haproxy.cfg file for a Docker test installation of WordPress containers [http://cloudstore.interoute.com/main/knowledge-centre/blog/coreos-docker-vdc-part3]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
log 127.0.0.1 local0 | |
log 127.0.0.1 local1 notice | |
user haproxy | |
group haproxy | |
defaults | |
log global | |
mode http | |
option httplog | |
option dontlognull | |
option forwardfor | |
option http-server-close | |
contimeout 5000 | |
clitimeout 50000 | |
srvtimeout 50000 | |
errorfile 400 /etc/haproxy/errors/400.http | |
errorfile 403 /etc/haproxy/errors/403.http | |
errorfile 408 /etc/haproxy/errors/408.http | |
errorfile 500 /etc/haproxy/errors/500.http | |
errorfile 502 /etc/haproxy/errors/502.http | |
errorfile 503 /etc/haproxy/errors/503.http | |
errorfile 504 /etc/haproxy/errors/504.http | |
stats enable | |
stats auth username:password | |
stats uri /haproxyStats | |
frontend http-in | |
bind *:80 | |
# Define your hostnames | |
acl wordpress_domain_1 hdr(host) -i wp1-docker.ddns.net | |
acl wordpress_domain_2 hdr(host) -i wp2-docker.ddns.net | |
acl wordpress_domain_3 hdr(host) -i wp3-docker.ddns.net | |
## figure out backend to use based on domainname | |
use_backend wordpress1 if wordpress_domain_1 # your first registered hostname | |
use_backend wordpress2 if wordpress_domain_2 # your second registered hostname | |
use_backend wordpress3 if wordpress_domain_3 # your third registered hostname | |
backend wordpress1 # wp1-docker.ddns.net container | |
balance roundrobin | |
option httpclose | |
option forwardfor | |
server s1 172.17.0.6:80 # This ip should be the ip of the wordpress container 1 | |
backend wordpress2 # wp2-docker.ddns.net container | |
balance roundrobin | |
option httpclose | |
option forwardfor | |
server s2 172.17.0.7:80 # This ip should be the ip of the wordpress container 2 | |
backend wordpress3 # wp3-docker.ddns.net container | |
balance roundrobin | |
option httpclose | |
option forwardfor | |
server s3 172.17.0.8:80 # This ip should be the ip of wordpress container 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment