首页 > 解决方案 > 在haproxy中添加一个静态html页面

问题描述

试图弄清楚如何将静态页面添加到 haproxy。

我有一个网站:https ://sky.example.com 我需要通过 Haproxy 添加静态页面https://sky.example.com/testing

我的配置文件 haproxy.cfg 如下所示:

global
   log /var/log loca2 err
   chroot /var/lib/haproxy
   user haproxy
   group haproxy
   daemon
   tune.ssl.default-dh-param 1024
   maxconn 8000de here
defaults
   mode http
   log global
   balance static-rr
   option httplog
   timeout server 300s
   timeout client 300s
   timeout connect 5s
   timeout queue 60s
   retries 3
   timeout http-request 60s
   maxconn 8000
frontend skying
   bind *:443 ssl crt /etc/haproxy/ssl/testing.pem
   option forwardfor
   acl modelx hdr(host) -i sky.example.com
   use_backend missmay if modelx
   acl is_info_testing path /testing
   use_backend missmay if is_info_testing
backend missmay
   mode http
   errorfile 200 /etc/haproxy/static/testing.html
   server test1_node1 192.168.1.25:78222 check cookie test1_node1
   server test1_node2 192.168.1.26:78222 check cookie test1_node2

但它不起作用。当我尝试获取页面https://sky.example.com/testing时出现 404 错误

标签: linuxhaproxy

解决方案


根据您的配置文件很难说到底出了什么问题,但我建议您先检查 haproxy 版本。有时不同的版本可能会导致这样的问题。


推荐阅读