HAProxy允许所有后缀

HAProxy允许所有后缀,proxy,reverse,haproxy,proxmox,Proxy,Reverse,Haproxy,Proxmox,我安装了一个带有Proxmox和一些lxc容器的服务器。在此服务器上,多个域应仅使用一个公共IP运行。目前,我正在尝试使用HAProxy实现反向代理,但它不允许使用子文件夹或变量 例如,此访问不可能: domain.tld/css/default.css domain.tld/system/login 如何允许所有连接 我的配置: frontend http_in mode tcp bind *:80 bind *:443 tcp-request inspect

我安装了一个带有Proxmox和一些lxc容器的服务器。在此服务器上,多个域应仅使用一个公共IP运行。目前,我正在尝试使用HAProxy实现反向代理,但它不允许使用子文件夹或变量

例如,此访问不可能: domain.tld/css/default.css domain.tld/system/login

如何允许所有连接

我的配置:

frontend http_in
    mode tcp
    bind *:80
    bind *:443

    tcp-request inspect-delay 5s
    acl sslv3 req.ssl_ver 3
    tcp-request content reject if sslv3
    tcp-request content accept if { req_ssl_hello_type 1 }

    acl web1 hdr(host) -i domain1.tld

    acl web2 hdr(host) -i domain2.tld

    use_backend web1 if web1
    use_backend web2 if web2

backend web1
        mode tcp
        server web1 10.10.10.110

backend web2
        mode tcp
        server web2 10.10.10.112

非常感谢。

根据此链接:

为了使hdr(主机)ACL工作,您应该在前端将模式设置为http(而不是tcp)。我使用类似的配置,模式设置为http时没有任何问题

一旦代理操作正常工作,路径(后缀)就不会有任何问题

haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2018-12-12 14:03:06 UTC; 6s ago
     Docs: man:haproxy(1)
           file:/usr/share/doc/haproxy/configuration.txt.gz
  Process: 4294 ExecStart=/usr/sbin/haproxy-systemd-wrapper -f $CONFIG -p $PIDFILE $EXTRAOPTS (code=exited, status=0/SUCCESS)
  Process: 4322 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code=exited, status=1/FAILURE)
 Main PID: 4294 (code=exited, status=0/SUCCESS)

Dec 12 14:03:06 haproxy systemd[1]: haproxy.service: Control process exited, code=exited status=1
Dec 12 14:03:06 haproxy systemd[1]: Failed to start HAProxy Load Balancer.
Dec 12 14:03:06 haproxy systemd[1]: haproxy.service: Unit entered failed state.
Dec 12 14:03:06 haproxy systemd[1]: haproxy.service: Failed with result 'exit-code'.
Dec 12 14:03:06 haproxy systemd[1]: haproxy.service: Service hold-off time over, scheduling restart.
Dec 12 14:03:06 haproxy systemd[1]: Stopped HAProxy Load Balancer.
Dec 12 14:03:06 haproxy systemd[1]: haproxy.service: Start request repeated too quickly.
Dec 12 14:03:06 haproxy systemd[1]: Failed to start HAProxy Load Balancer.
Dec 12 14:03:06 haproxy systemd[1]: haproxy.service: Unit entered failed state.
Dec 12 14:03:06 haproxy systemd[1]: haproxy.service: Failed with result 'exit-code'.


Dec 12 14:03:06 haproxy haproxy[4320]: [ALERT] 345/140306 (4320) : Fatal errors found in configuration.
Dec 12 14:03:06 haproxy haproxy[4321]: [ALERT] 345/140306 (4321) : http frontend 'http_in' (/etc/haproxy/haproxy.cfg:41) tries to use incompatible tcp backend 'web1' (/etc/haproxy/haproxy.cfg:61) in a 'use_backend' rule (see 'mode').
Dec 12 14:03:06 haproxy haproxy[4321]: [ALERT] 345/140306 (4321) : http frontend 'http_in' (/etc/haproxy/haproxy.cfg:41) tries to use incompatible tcp backend 'web2' (/etc/haproxy/haproxy.cfg:65) in a 'use_backend' rule (see 'mode').
 Dec 12 14:03:06 haproxy haproxy[4321]: [ALERT] 345/140306 (4321) : Fatal errors found in configuration.
Dec 12 14:03:06 haproxy haproxy[4322]: [ALERT] 345/140306 (4322) : http frontend 'http_in' (/etc/haproxy/haproxy.cfg:41) tries to use incompatible tcp backend 'web1' (/etc/haproxy/haproxy.cfg:61) in a 'use_backend' rule (see 'mode').
Dec 12 14:03:06 haproxy haproxy[4322]: [ALERT] 345/140306 (4322) : http frontend 'http_in' (/etc/haproxy/haproxy.cfg:41) tries to use incompatible tcp backend 'web2' (/etc/haproxy/haproxy.cfg:65) in a 'use_backend' rule (see 'mode').

我理解有什么不对劲吗?

怎么说它不起作用了?请求路由是否正确?你能分享一个例子,说明什么东西没有达到预期效果吗?好的,谢谢你的帮助。使用此配置,HA代理将不会启动。我将前端设置为http模式,后端设置为tcp模式。默认模式为tcp。是,也尝试过。前端和后端在http模式下和我有相同的问题。代理启动,但是该网站没有加载任何css或图像等等,除了我的配置:带有proxmox的主机在iptables中有这些,并通过端口80和443将所有连接路由到带有haproxy post-up iptables-t-nat-A PREROUTING-i vmbr0-p tcp-dport 80-j DNAT-to 10.10.10.100:80 post-down iptables-t-t-t-D PREROUTING-i vmbr0-p的来宾tcp--dport 80-j DNAT--to 10.10.10.100:80 post up iptables-t nat-A PREROUTING-i vmbr0-p tcp--dport 443-j DNAT--to 10.10.100:443 post down iptables-t nat-D PREROUTING-i vmbr0-p tcp--dport 443-j DNAT--10.10.10.100:443您从apache服务器收到一条404消息,这意味着您的请求到达后端。css、img等是否在本地ip上加载?非常感谢。这是一个apache配置问题:选项索引FollowSymLinks需要所有已授予的AllowOverride all……我不相信您可以将http前端请求路由到tcp后端。错误消息提示。