How To install Load Balancer with HAProxy on Debian

Hi, today I want to discuss on how to install a LB for web servers base on http (linux or windows) on debian.

First we need to add the source of the installation to sources.list
# vi /etc/apt/sources.list

and add the following lines:
deb etch main
deb-src etch main

deb lenny main

deb etch/updates main contrib
deb-src etch/updates main contrib

Next we need to update the sources and install the HAproxy

# apt-get update
# apt-get install haproxy

First we backup the original configuration
# cp /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.orig
# cat /dav/null > /etc/haproxy/haproxy.cfg

and new we create a new configuration for our Round Robin LB.
edit the haproxy.cfg file and add the following lines:
# vi /etc/haproxy/haproxy.cfg
        log   local0
        log   local1 notice
        maxconn 4096
        user haproxy
        group haproxy

        log     global
        mode    http
        option  httplog
        option  dontlognull
        retries 3
        maxconn 2000
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000

listen webfarm LB-IPAddress:80
       mode http
       stats enable
       stats auth someuser:somepassword
       balance roundrobin
       cookie JSESSIONID prefix
       option httpclose
       option forwardfor
       server webA serverA-IP:80 cookie A check
       server webB serverB-IP:80 cookie B check

make sure you change the RED lines to your settings.
and now we need to ENABLE the haproxy in /etc/default/haproxy
# vi /etc/default/haproxy
and set ENABLE=1

to start haproxy just run:
# /etc/init.d/haproxy start

that's it you have a Load Balancer Installed and work.

HAproxy Statistics:
In this configuration we enable the statistics of haproxy, you can acsses from you browser by enter http://LB-IPAddress/haproxy?stats

The user and the password is like you type in the configuration in "stats auth someuser:somepassword"

Enjoy and please comment !!!


How To install Apache MySQL and PHP

The easy way to install a web server with apache MySQL and PHP is by a project called XAMPP
XAMPP is a project of apache friends how let you the easy way to install Apache distribution containing MySQL, PHP and Perl.

I was trying to create a new WordPress blog on one of my servers. and I found this project very helpful.
All you have to do is to download a tar file from from XAMPP website untar him and thats it.
I will show you how it goes:

Download the last version of XAMPP from here -
Run the command:
tar xvfz xampp-linux-1.7.3a.tar.gz -C /opt

That's all. XAMPP is now installed below the /opt/lampp directory.
All you need to do to start the XAMPP is:
# /opt/lampp/lampp start

You should now see something like this on your screen:Starting XAMPP 1.7.3a...
LAMPP: Starting Apache...
LAMPP: Starting MySQL...
LAMPP started.

Go to your server via you browser ~ http://localhost

for more information and tricks go to the main project website -