-
-
Save haproxytechblog/38ef4b7d42f16cfe5c30f28ee3304dce to your computer and use it in GitHub Desktop.
Sample haproxy.cfg
This file contains 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 local2 | |
user haproxy | |
group haproxy | |
frontend main | |
bind *:80 | |
mode http | |
log global | |
option httplog | |
default_backend web | |
use_backend api if { path_beg -i /api/ } | |
#----------------------------------------------------------------- | |
# SSL termination - HAProxy handles the encryption. | |
# To use it, put your PEM file in /etc/haproxy/certs | |
# then edit and uncomment the bind line (75) | |
#----------------------------------------------------------------- | |
# bind *:443 ssl crt /etc/haproxy/certs/haproxy.pem ssl-min-ver TLSv1.2 | |
# redirect scheme https if !{ ssl_fc } | |
#--------------------------------------------------------------------- | |
# Enable stats at http://test.local:8404/stats | |
#--------------------------------------------------------------------- | |
frontend stats | |
bind *:8404 | |
stats enable | |
stats uri /stats | |
#--------------------------------------------------------------------- | |
# round robin balancing between the various backends | |
#--------------------------------------------------------------------- | |
backend web | |
server web1 127.0.0.1:10080 check | |
server web2 127.0.0.1:10081 check | |
#--------------------------------------------------------------------- | |
# API backend for serving up API content | |
#--------------------------------------------------------------------- | |
backend api | |
server api1 127.0.0.1:10082 check |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment