Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of installing and configuring HAProxy in CentOS 8

Shulou Source: shulou.com Published: 2022-06-03 04:51:02 11月14日 Update

This article is to share with you how to install and configure HAProxy in CentOS 8. I believe most people don't know how to install the configuration. In order to let you learn, I summarized the following contents. Without saying much, let's read on.

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

After reading this article, have you learned how to install and configure HAProxy? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel. Thank you for reading.

Tags: Configuration method content more articles keys names addresses most skills methods status environment look ports policies industries information information channels parts Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker MySQL Shulou Tech Info Redmi Linux