AD MANAGEMENT

Collapse

BEHOSTED

Collapse

Install HAproxy For Protecting Apache And Load Balancing

Collapse

Collapse

Edit this module to specify a template to display.

X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Install HAproxy For Protecting Apache And Load Balancing

    HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for web sites crawling under very high loads while needing persistence or Layer7 processing. Supporting tens of thousands of connections is clearly realistic with today’s hardware. Its mode of operation makes its integration into existing architectures very easy and risk less, while still offering the possibility not to expose fragile web servers to the Net

    You can read more here:- http://haproxy.1wt.eu/#desc

    Installing HAProxy:-

    You can check for the latest version here:- http://haproxy.1wt.eu/#down

    At present 1.5 is in development phase 7 and we are going to use that

    Note: The configuration file we have used is for single server Protection not for multiple server and made by its owner Willy Tarreau

    First:-

    wget http://haproxy.1wt.eu/download/1.5/s....5-dev7.tar.gz
    tar xvfz haproxy-1.5-dev7.tar.gz
    $ cd haproxy-1.5-dev7
    Second:-

    Now we have to compile the installation file, we are taking example of centos OS

    make install
    Third:-
    Now make a new directory and copy haproxy configuration file there

    mkdir /etc/haproxy
    cd /etc/haproxy
    vi haproxy.cfg
    change the ip address below and copy it to haproxy.cfg
    —————————————————————–

    global
    daemon
    maxconn 20000 # count about 1 GB per 20000 connections
    pidfile /var/run/haproxy.pid
    stats socket /var/run/haproxy.stat mode 600

    defaults
    mode http
    maxconn 19500 # Should be slightly smaller than global.maxconn.
    timeout client 60s # Client and server timeout must match the longest
    timeout server 60s # time we may wait for a response from the server.
    timeout queue 60s # Don’t queue requests too long if saturated.
    timeout connect 4s # There’s no reason to change this one.
    timeout http-request 5s # A complete request may never take that long.
    # Uncomment the following one to protect against nkiller2. But warning!
    # some slow clients might sometimes receive truncated data if last
    # segment is lost and never retransmitted :
    # option nolinger
    option http-server-close
    option abortonclose
    balance roundrobin
    option forwardfor # set the client’s IP in X-Forwarded-For.
    option tcp-smart-accept
    option tcp-smart-connect
    retries 2

    frontend public
    bind 192.168.1.1:80
    bind 192.168.1.2:80
    bind 192.168.1.3:80
    bind 192.168.1.4:80

    # table used to store behaviour of source IPs
    stick-table type ip size 200k expire 5m store gpc0,conn_rate(10s)

    # IPs that have gpc0 > 0 are blocked until the go away for at least 5 minutes
    acl source_is_abuser src_get_gpc0 gt 0
    tcp-request connection reject if source_is_abuser

    # connection rate abuses get blocked
    acl conn_rate_abuse sc1_conn_rate gt 30
    acl mark_as_abuser sc1_inc_gpc0 gt 0
    tcp-request connection track-sc1 src
    tcp-request connection reject if conn_rate_abuse mark_as_abuser

    default_backend apache

    backend apache
    # set the maxconn parameter below to match Apache’s MaxClients minus
    # one or two connections so that you can still directly connect to it.
    stats uri /haproxy?stats
    server srv 0.0.0.0:8181 maxconn 254

    # Enable the stats page on a dedicated port (8811). Monitoring request errors
    # on the frontend will tell us how many potential attacks were blocked.
    listen stats
    # Uncomment “disabled” below to disable the stats page :
    # disabled
    bind :8811
    stats uri /
    ——————————————————————

    In the above file replace 192.168.1.1 to 192.168.1.4 with your server ip address.

    Fourth:

    Change your Apache port to 8181 as in configuration file we are using that server srv 0.0.0.0:8181 maxconn 254.In WHM goto Tweak Settings and find Apache non-SSL IP/port and change it to 8181.

    Fifth:


    Restart apache

    /etc/init.d/apache2 restart
    Last:

    Start haproxy

    haproxy -f /etc/haproxy/haproxy.cfg
    Now we have to check if its working. Go to your stats page to see

    serverip:8811
    Replace serverip with your server ip used in configuration file and you will see full result generated by haproxy

    If you are facing any issue then feel free to contact us

    Article Source: How to configure Haproxy
    Cheap Shared Hosting | SSL Certificates | 100% Fully Managed Server | Reseller Hosting | Cpanel Demo | Register Domain Name | Free Website Builder | Web Hosting Blog

TEXT

Collapse

160

Collapse

Unconfigured Ad Widget

Collapse

GOOGLE

Collapse

Announcement

Collapse
1 of 2 < >

FreeHostForum Rules and Guidelines

Webmaster forum - Web Hosting Forum,Domain Name Forum, Web Design Forum, Travel Forum,World Forum, VPS Forum, Reseller Hosting Forum, Free Hosting Forum

Signature

Board-wide Policies:

Do not post links (ads) in posts or threads in non advertising forums.

Forum Rules
Posts are to be made in the relevant forum. Users are asked to read the forum descriptions before posting.

Members should post in a way that is respectful of other users. Flaming or abusing users in any way will not be tolerated and will lead to a warning or will be banned.

Members are asked to respect the copyright of other users, sites, media, etc.

Spam is not tolerated here in most circumstances. Users posting spam will be banned. The words and links will be censored.

The moderating, support and other teams reserve the right to edit or remove any post at any time. The determination of what is construed as indecent, vulgar, spam, etc. as noted in these points is up to Team Members and not users.

Any text links or images contain popups will be removed or changed.

Signatures
Signatures may contain up to four lines

Text in signatures is subject to the same conditions as posts with respect decency, warez, emoticons, etc.

Font sizes above 3 are not allowed

Links are permitted in signatures. Such links may be made to non-Freehostforum material, commercial ventures, etc. Links are included within the text and image limits above. Links to offensive sites may be subject to removal.

You are allowed ONLY ONE picture(banner) upto 120 pixels in width and 60 pixels in height with a maximum 30kB filesize.

In combination with a banner/picture you can have ONLY ONE LINE text link.


Advertising
Webmaster related advertising is allowed in Webmaster Marketplace section only. Free of charge.

Shopping related (tangible goods) advertising is allowed in Buy Sell Trade section only. Free of charge.

No advertising allowed except paid stickies in other sections.

Please make sure that your post is relevant.


More to come soon....
2 of 2 < >

Advertise at FreeHostForum

We offer competitive rates and a many kinds of advertising opportunities for both small and large scale campaigns.More and more webmasters find advertising at FreeHostForum.com is a useful way to promote their sites and services. That is why we now have many long-term advertisers.

At here, we also want to thank you all for your support.

For more details:
http://www.freehostforum.com/threads...eHostForum-com

More ad spots:
http://www.freehostforum.com/forums/...-FreeHostForum
See more
See less
Working...
X