0% found this document useful (0 votes)
92 views3 pages

Haproxy

The document discusses how to install and configure an Apache web server, HAProxy load balancer, and Nginx on a Linux system. It provides commands and configuration steps for setting up Apache and HAProxy, including installing packages, editing configuration files, starting services, and testing configurations. Load balancing configurations are shown for HAProxy to distribute traffic across multiple web servers on different ports and protocols.

Uploaded by

mahesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views3 pages

Haproxy

The document discusses how to install and configure an Apache web server, HAProxy load balancer, and Nginx on a Linux system. It provides commands and configuration steps for setting up Apache and HAProxy, including installing packages, editing configuration files, starting services, and testing configurations. Load balancing configurations are shown for HAProxy to distribute traffic across multiple web servers on different ports and protocols.

Uploaded by

mahesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

ifconfig

Ping
curl
netstat
nslookup
hostfile changes for lookup usning DNS
telnet
top

Web Server:
Apt get install httpd

Install configure -> Start service

/etc/httpd/conf/httpd.conf

namebased and IP based servers

systemctl start httpd

Diff between HAProxy / Nginx (Reroute)

Installation:
1. 2 web server - apache 1 & apache 2

Sudo apt-get install haproxy


cd /etc/haproxy
cp haproxy.cfg haproxy.cfg.original
vi haproxy.cfg
global
# for logging section
log 127.0.0.1 local2 info #local ip & host of Haproxy server
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
# max per-process number of connections
maxconn 256
# process' user and group
user haproxy
group haproxy
# makes the process fork into background
daemon

defaults
# running mode
mode http # use tcp for DB loadbalancing
# use global settings
log global
# get HTTP request log
option httplog
# timeout if backends do not reply
timeout connect 10s
# timeout on client side
timeout client 30s
# timeout on server side
timeout server 30s

#configure Stats
listen stats # Define a listen section called "stats"
bind :9000 # Listen on localhost:9000
mode http
stats enable # Enable stats page
stats hide-version # Hide HAProxy version
stats realm Haproxy\ Statistics # Title text for popup window
stats uri /haproxy_stats # Stats URI
stats auth Username:Password # Authentication credentials
# define frontend ( set any name for "http-in" section )
frontend http-in
# listen 80
bind *:80 #chnage to 90 restart LB will run on 90
# set default backend
default_backend backend_servers
# send X-Forwarded-For header
option forwardfor

# define backend
backend backend_servers
# balance with roundrobin
balance roundrobin #weighted#leastconnection
# define backend servers
server client2 192.168.56.202:80 check
server client4 192.168.56.206:80 check

Systemctl start haproxy

Apache bechmark tool for increasing connections ....


diff betn demon processes & process
add & to run command in demon mode
/8080/stats

non standard port fwd:


# define frontend ( set any name for "http-in" section )
frontend http-in
# listen 90
bind *:80 #chnage to 90 restart LB will run on 90
# set default backend
default_backend backend_servers_90
# send X-Forwarded-For header
option forwardfor

# define backend
backend backend_servers_90
# balance with roundrobin
balance roundrobin #weighted#leastconnection
# define backend servers
server client2 192.168.56.202:80 check
server client4 192.168.56.206:80 check

netstat tulpn

/etc/syscon/selini
disable Selinux
Multiport:

# define frontend ( set any name for "http-in" section )


frontend http-in
# listen 80
bind *:443 #chnage to 90 restart LB will run on 90
# set default backend
default_backend backend_servers_90
# send X-Forwarded-For header
option forwardfor

# define backend
backend backend_servers_443
# balance with roundrobin
balance roundrobin #weighted#leastconnection

# define backend servers


server client2 192.168.56.202:80 check
server client4 192.168.56.206:80 check
SSL

You might also like