Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

HAProxy erection notes

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report