@SteinerSE wrote:
I’ve been goggling and looking for guides and tried piecing this together with lo luck whatsoever. What I need to do is direct web traffic to different servers depending on the domain (for now)… I’m using the latest HAProxy (1.7.9 running on an Ubuntu machine (virtual) and my router directs all traffic for port 80 to it.
I’ve been following what guides I could find to the best of my understanding and I finally have the service at least start without failure, but once running it seems it completely ignores all my hostmapping and just sends everything to the default backend.
I have 3 webservers running on 3 different machines with their own static IPs (2 Apache and 1 IIS) and this is the config I’ve come up with.global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 256# Default SSL material locations ca-base /etc/ssl/certs crt-base /etc/ssl/private # Default ciphers to use on SSL-enabled listening sockets. # For more information, see ciphers(1SSL). This list is from: # https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/ # An alternative list with additional directives can be obtained from # https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS ssl-default-bind-options no-sslv3
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http# My stuff stats enable stats uri /hapstats stats realm "HAProxy\ Statistics" stats auth steiner:password stats refresh 5s
frontend http-in
bind *:80# Define hosts acl host_tifozi hdr(host) -i tifozi.net acl host_tabardinn hdr(host) -i yetabardinn.net acl host_tacticus hdr(host) -i tacticus.org acl host_secunet hdr(host) -i secunet.se acl host_windhund hdr(host) -i windhund.biz # Hostmapping use_backend Srv_1 if host_tacticus use_backend Srv_1 if host_windhund use_backend Srv_2 if host_tifozi use_backend Srv_2 if host_tabardinn use_backend Srv_3 if host_secunet default_backend Srv_1
backend Srv_1
option forwardfor
option httpclose
server Apache_1 10.84.42.4:80 checkbackend Srv_2
option forwardfor
option httpclose
server Apache_2 10.84.42.15:80 checkbackend Srv_3
option forwardfor
option httpclose
server IIS_1 10.84.42.14:80 checkPlease someone help me figure this out and point me in the right direction, I would be immensely grateful!
Posts: 5
Participants: 2