HAproxy

HAProxy - basic authentication for backend server

廉价感情. 提交于 2021-02-19 03:43:05
问题 I use the following configuration to access internet from local 127.0.0.1:2000 proxy to the internet.: global log 127.0.0.1 local0 log 127.0.0.1 local1 notice #log loghost local0 info maxconn 4096 #chroot /usr/share/haproxy user haproxy group haproxy daemon #debug #quiet defaults log global mode http option httplog option dontlognull retries 3 option redispatch maxconn 2000 contimeout 5000 clitimeout 50000 srvtimeout 50000 listen appname 0.0.0.0:2000 mode http stats enable acl white_list src

Is it possible to rewrite HOST header in k8s Ingress Controller?

我只是一个虾纸丫 提交于 2021-02-18 10:20:41
问题 Due to some legacy application that relies on Host header to function correctly, I need to have an Ingress (proxy, etc) that capable of rewrite Host header and pass that to downstream (backend). Is there any Ingress Controller that supports this functionality? Example: End user access our website through foo.com/a for backend a and foo.com/b for backend b . But since a and b are legacy app, it only accept: a accepts connection when Host: a.foo.com b accepts connection when Host: b.foo.com 回答1

配置nginx的负载均衡

我的梦境 提交于 2021-02-17 09:01:41
-------------------- 写在这是方便大家找 nginx的安装配置三部曲:点击即可查看 1、安装和配置文件的基础配置,ctrl+f搜索nginx 2、nginx文档如何查看 + 常用的配置方式(伪静态,反向代理,动静分离,防盗链,图片缓存,gzip图片压缩) 3、高级配置-》负载均衡 --------------------- nginx反向代理 负载均衡 软件负载均衡 lvs nginx haproxy 硬件负载均衡 f5 netscalar 总结:1台就是反向代理,多台就是负载均衡 1、反向代理就是后端服务不直接对外暴露,请求首先发送到nginx,然后nginx将请求转发到后端服务器,比如tomcat php等.如果后端服务只有一台服务器,nginx在这里只有一个作用就是起到了代理后端服务接收请求的作用.称之为反向代理. 2、可是在现实的应用场景中,一台后端服务器出现单点故障的概率很大或者单台机器的吞吐量有限,无法承担过多请求.这时候就需要在nginx后端配置多台服务器,利用nginx内置的规则讲请求转发到后端不同的机器上.这时候就起到了负载均衡的作用. 原理、效果、配置文件 注意:访问的,test.xiyang66.top域名指向的ip就是47.94.21.171,所以用域名也行,用ip也行 配置文件这样写 // 写在 http中,upstream

Let's Encrypt免费泛域名证书申请

陌路散爱 提交于 2021-02-16 10:54:34
一. 下载acme.sh,以下四条命令任选一条即可 curl https: // get.acme.sh | sh wget -O - https://get.acme.sh | sh curl https: // raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 sh wget -O - https: // raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 sh 二、申请Let’s Encrypt免费泛域名证书 第一步获取验证DNS所需要的TXT记录,下面命令中两个“-d”建议先输入泛域名,这样在证书里可以显示*.alsji.cn这样的泛域名,显得比较吊一些。 [root@test ~]# acme. sh --issue -d *.alsji.cn --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please 三、到域名DNS解析服务商处添加域名的TXT解析 上面的命令运行后可能要等上一会,然后会出现下图的结果,其中绿色部分就是需要做TXT记录的主机头和TXT的解析值,因为上面第二里面两个“-d”,所以这里有两个解析值

Haproxy官方文档翻译(第二章)配置Haproxy 附英文原文

我们两清 提交于 2021-02-11 13:23:04
2.配置 HAProxy 2.1 配置文件格式 Haproxy的配置过程包含了3部分的参数资源: - 命令行中的参数,此种参数总是享有优先权被使用 - 配置文件中global节点中的参数,此种参数是进程范围参数 - 代理节点参数,此种参数是从defaults,listen,frontend,backend节点中读取的 这个手册里,以关键字起始并作为关联引用的行,组成了配置文件的语法结构。后面跟上可选的一个或者几个用空格隔开的参数。 2.2 引用(Quoting)和转义(escaping) Haproxy的配置介绍了一个像大多数编程语言一样的引用和转义的系统。配置文件支持3种类型:用一个反斜杠(\),弱引用用双引号, 强引用用单引号。 如果字符串中必须要加入空格,必须要在它们前面加上反斜杠('\')来转义它们或者用引号引起来。反斜杠也必须用双反斜杠或者强引用来转义它们。 我们在一个特殊字符前面加上反斜杠('\')来表达一个转义: \ 用来表示空格,以区分一个分隔符 \# 用来表示一个#号,以区分注释符号 \\ 表示一个反斜杠 \' 表示一个单引号,以区分强引用 \" 表示一个双引号,以区分弱引用 弱引用使用双引号来实现("")。用来阻止解释语义(使特殊字符变为普通字符,比如让以下特殊字符所表示的特殊意义失效): 空格字符表示参数的分隔符 ‘ 单引号表示强引用的分隔符 #

haproxy will get 404 error for about 2-3 seconds if one of backend server down

与世无争的帅哥 提交于 2021-02-11 13:10:59
问题 this is the haproxy config. defaults option forwardfor log global option httplog log 127.0.0.1 local3 option dontlognull retries 3 option redispatch timeout connect 5000ms timeout client 5000ms timeout server 5000ms listen stats bind *:9000 mode http .............................................. backend testhosts mode http balance roundrobin option httpchk HEAD /sabrix/scripts/menu-common.js server host1 11.11.11.11:9080 check inter 2000 rise 1 fall 2 server host2 11.11.11.12:9080 check

haproxy will get 404 error for about 2-3 seconds if one of backend server down

泪湿孤枕 提交于 2021-02-11 13:09:33
问题 this is the haproxy config. defaults option forwardfor log global option httplog log 127.0.0.1 local3 option dontlognull retries 3 option redispatch timeout connect 5000ms timeout client 5000ms timeout server 5000ms listen stats bind *:9000 mode http .............................................. backend testhosts mode http balance roundrobin option httpchk HEAD /sabrix/scripts/menu-common.js server host1 11.11.11.11:9080 check inter 2000 rise 1 fall 2 server host2 11.11.11.12:9080 check

haproxy will get 404 error for about 2-3 seconds if one of backend server down

允我心安 提交于 2021-02-11 13:08:40
问题 this is the haproxy config. defaults option forwardfor log global option httplog log 127.0.0.1 local3 option dontlognull retries 3 option redispatch timeout connect 5000ms timeout client 5000ms timeout server 5000ms listen stats bind *:9000 mode http .............................................. backend testhosts mode http balance roundrobin option httpchk HEAD /sabrix/scripts/menu-common.js server host1 11.11.11.11:9080 check inter 2000 rise 1 fall 2 server host2 11.11.11.12:9080 check

HAProxy random Empty Response

若如初见. 提交于 2021-02-11 10:24:25
问题 I installed a HAPROXY for balance between two servers. Unfortunately the HAPROXY return random ERR_EMPTY_RESPONSE. I installed the stats also but the stats does not appear frequently because sometimes the stats is shown. I double check with some friends my configuration and I did not found problems. defaults timeout connect 3000ms timeout server 10000ms timeout client 10000ms global log 127.0.0.1 local0 notice maxconn 2000 user haproxy group haproxy frontend stats bind *:1936 mode http stats

TCP load balancing and rerouting based on first few bytes

痴心易碎 提交于 2021-02-09 14:27:32
问题 I have made a game where clients connect to a central server with TCP connection. In the first 6 bytes I send the version number "00.00.01" of the client protocol. Based on this version I want to route/proxy the tcp connection to different servers where different version of the game will be running. Basically client-1 with version 00.00.01 should connect to Server-1 And client 2 with version 00.00.02 should connect to Server-2 For load balancing I checked HAProxy lua support but couldn't find