Get the App
SLTechnology News&Howtos  ›  Servers  › 

HAProxy erection notes

Shulou Source: shulou.com Published: 2022-06-02 07:22:03 10月04日 Update

Requirements: simple layer 4 (SSH) and layer 7 (HTTP) reverse proxy

Erection environment: CentOS 8

Installation

> sudo dnf install haproxy

Configuration

> sudo vim / etc/haproxy/haproxy.cfg# the following is the key modification part global. Maxconn 20480 ulimit-n 65535... default... Stats uri / haproxy?stats # View the status of haproxy Address http:///haproxy?stats. # define layer 7 HTTP forwarding frontend sdc bind *: 80 # define acl for different streamset data controller server acl sdc1-policy hdr_dom (host)-I sdc1.3rd.pla95929 acl sdc2-policy hdr_dom (host)-I sdc2.3rd.pla95929 # backend for acl use_backend server_sdc1 if sdc1-policy use_backend server_sdc2 if sdc2-policy # send X-Forwarded -For header option forwardfor except 127.0.0.0/8backend server_sdc1 server srv sdc1:18630 checkbackend server_sdc2 server srv sdc2:18630 check# sdc1 and sdc2 are recorded in haproxy / etc/hosts You can also directly write ip,srv for the custom name # define layer 4 TCP forwarding listen ssh-sdc1 mode tcp option tcplog tcp-request inspect-delay 5s bind *: 2201 server node sdc1:22 checklisten ssh-sdc2 mode tcp option tcplog tcp-request inspect-delay 5s bind *: 220 layer 4 inversion cannot configure acl policy by checking host, it can only be implemented by port binding

Tags: Configuration key name address method status environment port policy parts requirements agents checks notes Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Docker Linux MariaDB Shulou Technology