Hyae
Hyae

Reputation: 1

HAProxy with public IP Adress

I have many servers in another internet data center. Can i use haproxy for load balance each website in them. Follow the documentation in the backend only using private IP how to use public IP like below. If it can't have any app can do that? Thanks.

These are my settings: haproxy.cfg

global
    daemon
    maxconn 256
    user        haproxy
    group       haproxy
    chroot      /var/lib/haproxy

defaults
    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

frontend http
    bind *:80
    default_backend servers

backend servers
    server server public ip?
    server server public ip?
    server server public ip?

Upvotes: 0

Views: 3164

Answers (2)

J-Jacques M
J-Jacques M

Reputation: 1118

You can do like this:

global
    daemon
    maxconn 256
    user        haproxy
    group       haproxy
    chroot      /var/lib/haproxy

defaults
    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

frontend http
    bind *:80
    default_backend servers

backend servers
    balance roundrobin
    mode http
    option forwardfor
    option httpchk GET /
    server server1 public.com check
    server server2 123.123.123.123 check
    server server3 public.com check

HAProxy support IP and DNS

Upvotes: 1

peeebeee
peeebeee

Reputation: 2618

The IP address of the server can be any IP it can be reached on from the proxy. Typically it's a private address on the same network as the server, but it doesn't have to be - a public address of a server the other side of the world works, too.

Upvotes: 0

Related Questions