Using HAProxy with Virtualmin

2 posts / 0 new
Last post
#1 Tue, 06/02/2015 - 06:59
Brook

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?

Wed, 06/03/2015 - 19:31
Brook

Well I went ahead and followed the instructions here: https://www.virtualmin.com/documentation/system/varnish

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         127.0.0.1 local2

    # chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

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

defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    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 my_discourse_site.com

        # figure out which one to use
        use_backend discourse_docker if host_discourse

backend main_apache_sites
    server server1 127.0.0.1:8080 cookie A check

backend discourse_docker
    server server2 127.0.0.1:8888 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
Topic locked