# Settings examples of HAproxy
# listen 80, allocate to 10004 and 10005 by roundrobin
frontend main
bind *:80
default_backend app
backend app
server app1 127.0.0.1:10004
server app2 127.0.0.1:10005
# HTTPS with SSL offloading (opens new window)
frontend ssl_proxy
mode http
default_backend app
bind *:443 ssl crt /etc/letsencrypt/live/mydomain.com/mydomain.com.4haproxy.pem
# virtual host tako.mydomain.com, ika.mydomain.com, uni.mydomain.com
backend ssl
acl tako hdr(host) -m str tako.mydomain.com
use-server tako if tako
server tako 127.0.0.1:10004
acl ika hdr(host) -m str ika.mydomain.com
use-server ika if ika
server ika 127.0.0.1:10005
acl uni hdr(host) -m str uni.mydomain.com
use-server uni if uni
server uni 127.0.0.1:10006
# references
- official document (opens new window)
- version confirmation
ueda@scw-a:~$ /usr/sbin/haproxy -v
HA-Proxy version 1.7.5-2 2017/05/17
Copyright 2000-2017 Willy Tarreau <willy@haproxy.org>
- install (opens new window)
- start:
sudo systemctl start haproxy.service
- restart:
sudo systemctl restart haproxy.service
- stop:
sudo systemctl stop haproxy.service
- status check:
sudo systemctl status haproxy.service
← haproxy