Using HAProxy with Virtualmin

I’ve never used HAProxy before - anyone have any tips on how I can add this to my Virtualmin powered server?

I’d like HAProxy to divert traffic for a specific domain to another port (docker container), but everything else to the normal Apache/Virtualmin setup.

Is this possible? Would it cause any issues to my Virtualmin setup or sites?

Well I went ahead and followed the instructions here:

But for some reason, none of my virtualmin sites work (the Docker site works fine).

I have also played with the HAproxy config, switching the default_backend from loading my apache sites, to the docker site - it works for the docker site but not apache sites so the ‘default_backend’ definitely works (I commented out all other lines).

Here is my HAproxy config:

global # to have these messages end up in /var/log/haproxy.log you will # need to: # # 1) configure syslog to accept network log events. This is done # by adding the '-r' option to the SYSLOGD_OPTIONS in # /etc/sysconfig/syslog # # 2) configure local2 events to go to the /var/log/haproxy.log # file. A line like the following can be added to # /etc/sysconfig/syslog # # local2.* /var/log/haproxy.log # log local2
# chroot      /var/lib/haproxy
pidfile     /var/run/
maxconn     4000
user        haproxy
group       haproxy

# turn on stats unix socket
stats socket /var/lib/haproxy/stats

mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000

frontend http-in
bind *:80
default_backend main_apache_sites

    # Define hosts
    acl host_discourse hdr(host) -i
    # figure out which one to use
    use_backend discourse_docker if host_discourse

backend main_apache_sites
server server1 cookie A check

backend discourse_docker
server server2 cookie A check

Can anyone see any problems here?

All I get for my virtualmin sites is a blank page with:

Index of /

[ICO] Name Last modified Size Description