5 Website Development Tips To Boost Your Business Growth Exponentially

Load Balancing Named Virtual Hosts

 

Un-Complete

How to setup load balancing on multiple websites with only 1 Public IP address available using HAProxy.

Some may wonder how you can host multiple websites on multiple servers when you only have 1 public ip address available it is simple.

We will first need to have linux setup and  configuired.  I have used Centos 5.4 in my example.

 

global
maxconn 4096
pidfile /var/run/haproxy.pid
daemon
nbproc 2 # Number of processing cores. Dual Dual-core Opteron is 4 cores for example.

defaults
mode http
balance roundrobin
cookie SERVERID insert indirect
stats enable
option forwardfor    
retries 3
option redispatch
maxconn 20000
contimeout 50000
timeout client 500000
timeout server 500000
default_backend www

frontend Cyford 192.168.111.55:80
acl extranet hdr_end(host) -i extranet.cyfordtechnologies.com
use_backend extranet if extranet
acl www hdr_end(host) -i cyfordtechnologies.com    
use_backend www if www
default_backend www

backend www
stats enable
server CyfordWeb-0001-v1C 192.168.1.10:80  check
server CyfordWeb-0002-v1U 192.168.1.11:80  check

backend extranet
stats enable
server CyfordWeb-0001-v1C 192.168.1.20:80  check
server CyfordWeb-0002-v1U 192.168.1.21:80  check

 Updted and more complete instructions can be found here:  https://www.cyfordtechnologies.com/linux-servers/setting-up-haproxy


Published on: Mar 03, 2021

Categories: Web Development

    No Comments yet! Be the first one to write.


    Leave a Reply

    Your email address will not be published. Required fields are marked *

    user IP : 3.135.213.214 | Server_IP: 192.168.111.165 | IP_Score: