

# apt-get install apache2 Īfter you install Apache on these 2 web servers, just open your web browser and visit their ip addresses as You should be able to see the default Apache screen. Open terminals on the four web servers at 54.43.32.22, 54.43.32.23 and run the following commands. For our example, we will setup load balancer at IP address 54.43.32.21 and domain We will use HAProxy to distribute load among 2 web servers with IP addresses 54.43.32.22, 54.43.32.23 each running Apache server.įirst, we need to install Apache web server on all the 2 web servers. Here are the steps to install HAProxy load balancer configuration in Linux. HAProxy Load Balancer Configuration in Linux In this article, we will look at how to install & configure HAProxy as a high availability load balancer that distributes requests across multiple web servers. HAProxy is available for almost all Linux distributions. It allows you to easily distribute workload among multiple web servers, database servers, etc. Here I am keeping the logs upto 120 days hence rotate 120 and daily is written in file.HAProxy is a free, open source high availability proxy server and load balancer that is used with popular web servers such as Apache, NGINX, etc. If bydefault it is not present in /etc/logrotate.d directory then create a new file called haproxy and paste the given below code. Step 4: Check your logrotae file for haproxy also so that logs keep on rotating and compress itself. Local0.notice -/var/log/haproxy-status.log HaproxyĪfter restarting the haproxy service two logs will be created itself i.e haproxy.log and haproxy-status.log Local0.=info -/var/log/haproxy.log Haproxy UDPServerRun 514 means opening UDP port no.


local0.=info -/var/log/haproxy.log defines the http log will be saved in haproxy.log.Here we are keeping the log in localhost or in other words we should say HAproxy server Step 2: Create new haproxy configuration file in /etc/rsyslog.d. Step 1: In Global Section of haproxy.cfg put the value log 127.0.0.1 local0. To setup logging in HAproxy,follow the given below steps After installing the HAproxy 1.4 in CentOS 6.4 bydefault logging of haproxy was not enable.To enable the logging of HAProxy you have to enable it in rsyslog(In CentOS 6.4 minimal installation,rsyslog version 5.2 is shipped).
