Configuration 单倍体构型

Configuration 单倍体构型,configuration,haproxy,Configuration,Haproxy,有人能帮我配置我的haproxy吗: 在同一台服务器上,多个端口用于不同的应用程序,我想为它们创建配置: 例如,如果我在我的web浏览器test.testdev.com中输入,我想重定向到192.168.24.121:8080,如果type test.testdev.com/test-test/api,我想转到192.168.24.121:10000/test-test/api 我的配置: acl testaaa_url hdr_dom(host) -i test.testdev.com acl

有人能帮我配置我的haproxy吗:

在同一台服务器上,多个端口用于不同的应用程序,我想为它们创建配置:

例如,如果我在我的web浏览器test.testdev.com中输入,我想重定向到192.168.24.121:8080,如果type test.testdev.com/test-test/api,我想转到192.168.24.121:10000/test-test/api

我的配置

acl testaaa_url hdr_dom(host) -i test.testdev.com
acl testbbb_url hdr_end(host) -i test.testdev.com/test-test

use_backend testaaa if_testaaa_url
user_backend testbbb if testbbb_url


backend testaaa
mode http
server testaaa 192.168.24.121:8080

backend testbbb 
mode http
server testbbb 192.168.24.121:10000

您的ACL无法计算。没有“用户\后端”设置

对于第二个ACL,您试图在主机头的末尾(因此为“hdr_end”)匹配“test.testdev.com/test test”。但是您的主机头只是“test.testdev.com”

您可能正在查找的ACL可能是:

acl testbbb_url path -i -m beg /test-test
匹配任何HTTP资源匹配/测试

使用和操作员如下所示:

use_backend testbbb if testaaa_url testbbb_url
acl testaaa_url hdr_dom(host) -i test.testdev.com
acl testbbb_url path -i -m beg /test-test

use_backend testbbb if testaaa_url testbbb_url
use_backend testaaa if testaaa_url

backend testaaa
 mode http
 server testaaa 192.168.24.121:8080

backend testbbb
 mode http
 server testbbb 192.168.24.121:10000
这样,两个ACL都必须为true,条件才能变为true并转发给testbbb。(意思是:主机头必须匹配“test.testdev.com”,HTTP资源的开头必须匹配“/test test”

最终您将得到如下粗略配置:

use_backend testbbb if testaaa_url testbbb_url
acl testaaa_url hdr_dom(host) -i test.testdev.com
acl testbbb_url path -i -m beg /test-test

use_backend testbbb if testaaa_url testbbb_url
use_backend testaaa if testaaa_url

backend testaaa
 mode http
 server testaaa 192.168.24.121:8080

backend testbbb
 mode http
 server testbbb 192.168.24.121:10000
一个好的起点是和作为后续文献