# Settings examples of HAproxy

# listen 80, allocate to 10004 and 10005 by roundrobin

frontend  main
		bind *:80
    default_backend             app

backend app
    server  app1
    server  app2

# 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

	acl ika hdr(host) -m str ika.mydomain.com
	use-server ika if ika
	server ika

	acl uni hdr(host) -m str uni.mydomain.com
	use-server uni if uni
	server uni

# references

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
Last Updated: 7/4/2020, 8:08:14 AM