본문 바로가기

IaC Application/proxy

haproxy.service

원복

--director
[root@localhost ~]# ipvsadm -C
[root@localhost ~]# ipvsadm -L
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
[root@localhost ~]# dnf -y remove ipvsadm

 

[root@localhost ~]# sysctl -p
net.ipv4.ip_forward = 1
[root@localhost ~]# dnf -y install haproxy
[root@localhost ~]# ifconfig ens160:1 172.16.0.200 netmask 255.255.255.0
[root@localhost ~]# find / -name haproxy.cfg
/etc/haproxy/haproxy.cfg
 #vi /etc/haproxy/haproxy.cfg 
 #    bind *:5000
     bind *:80
     acl url_static       path_beg       -i /static /images /javascript /stylesheets
     acl url_static       path_end       -i .jpg .gif .png .css .js
     
      use_backend static          if url_static
#    default_backend             app
      default_backend             static

backend static
    balance     roundrobin
#    server      static 127.0.0.1:4331 check
    server      server1 10.10.10.1:80 check
    server      server2 10.10.10.2:80 check

[root@localhost ~]# systemctl start haproxy.service

 

w-10

 

host

'IaC Application > proxy' 카테고리의 다른 글

ipvsadm.service dnat  (0) 2024.03.22
ipvsadm.service : reverse proxy  (0) 2024.03.22
Proxy Server  (1) 2024.03.22