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.
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
All I get for my virtualmin sites is a blank page with:
Index of /
[ICO] Name Last modified Size Description
Are there any known problems where Virtualmin sites stop working when the Apache port is changed? Have I missed anything? Do you have any other advice which I could try?
Comments
Submitted by Chris_C on Thu, 06/04/2015 - 09:13 Comment #1
What do you see in your browser when you hit one of your virtualmin sites with the url http://myvirtualminsite.com:8080
It should show the site , not the directory listing of files as you were seeing via haproxy...
Submitted by andreychek on Thu, 06/04/2015 - 10:13 Comment #2
Submitted by Brook on Fri, 06/05/2015 - 05:02 Comment #3
Tried this again tonight (as that's when the sites are at their quietest) but still the same.
Going to domain.com:8080 shows the site for some sites but not all (I think those have htaccess directives, such as for replacing the root index with a specific file).
Any other ideas I can try?
Edit: forgot to say that with Apache stopped, going to a domain says that a server can't be found, so HAproxy does seem to be channelling things to port 8080.
Submitted by Brook on Fri, 06/05/2015 - 11:18 Comment #4
Are there any other settings in Virtualmin that need to be changed?
What about in Webmin > servers > apache > global > networking & addresses ? (Although the first field does pick up the change in port after you edit httpd.conf)
Submitted by andreychek on Fri, 06/05/2015 - 12:10 Comment #5
I don't believe you're seeing a Virtualmin bug there. I don't know of any issues when changing the ports, and we didn't run into any issues when we did so during the testing that Varnish setup that you saw.
It appears to be something that may require some configuration tweaks (though we may need to dig into it further to get an idea of what's going on).
The next step would be to do some troubleshooting to determine exactly what's going on.
The best place to do the troubleshooting for that would be over in the Forums though since you appear to be using Virtualmin GPL there.
What you may want to do is post a new Forum thread, and in that, include the issue you're seeing here, along with the Apache config that you have for some of your domains.
While I'm not familiar with HAproxy, it sounds like it'd be similar to how Varnish works.
Submitted by Brook on Fri, 06/05/2015 - 14:48 Comment #6
Ok thanks - I'll try again tonight with a very basic HAproxy config and see if that makes any difference, if not I'll start a thread in the forum.
Should I link to this issue or just copy the contents of the first post?
Submitted by Brook on Sat, 06/06/2015 - 05:07 Comment #7
Ok I have posted a forum thread here: https://www.virtualmin.com/node/37307 any help would be greatly appreciated :)
Submitted by andreychek on Sat, 06/06/2015 - 10:18 Comment #9
Sorry for the delay -- yeah posting a link is fine. I'll take a look in a bit. Thanks for creating a new Forum thread!