[英]nginx behind haproxy to static html ssl getting real IP address
[英]Add a static html page for through in haproxy
試圖弄清楚如何將 static 頁面添加到 haproxy。
I have a website: https://sky.example.com And i need to add addition static page https://sky.example.com/testing through Haproxy
我的配置文件 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 錯誤
根據您的配置文件很難說到底出了什么問題,但我建議您先檢查 haproxy 版本。 有時不同的版本可能會導致這樣的問題。
您正在尋找的是listen
和monitor-uri 。 以下配置位於defaults
下方,用於端口 80 上的 static 文件 200.http:
listen static-file
bind :80
monitor-uri /
errorfile 200 /usr/local/etc/haproxy/errors/200.http
200.http 的內容可以是:
HTTP/1.0 200 OK
Cache-Control: no-cache
Connection: close
Content-Type: text/html
<html><body><h1>200 we are good</h1>
Health checked.
</body></html>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.