skip to Main Content

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?

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search