Can anyone please help troubleshoot my haproxy/virtualmin problems please?
I followed the instructions here: https://www.virtualmin.com/documentation/system/varnish but instead of using Varnish, I am using HAproxy to divert traffic either to my Virtualmin sites (Apache port 8080) or a docker container.
However 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).
Additionally, when Apache is stopped, going to a virtualmin site says that a server can’t be found - so it seems that HAproxy is actually diverting traffic the correct port.
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
All I get for my virtualmin sites is a blank page with:
Index of /
[ICO] Name Last modified Size Description
One thing I did notice is that on restarting Apache I get a number of these messages:
[Sat Jun 06 10:28:17 2015] [warn] VirtualHost 2a01:4f8:150:146c::2:80 overlaps with VirtualHost 2a01:4f8:150:146c::2:80, the first has precedence, perhaps you need a NameVirtualHost directive
…which I thought was because I hadn’t changed the port settings for each domain (I am trying to get one working before changing all of the other domain settings) could this be an issue? (On previous attempts I did actually change all of the domains - but that was one of the first attempts).
Any help in sorting this would be greatly appreciated.