Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794
{"id":2847,"date":"2019-12-27T06:39:01","date_gmt":"2019-12-27T06:39:01","guid":{"rendered":"https:\/\/support.aklwebhost.com\/?post_type=manual_kb&p=2847"},"modified":"2019-12-27T06:40:16","modified_gmt":"2019-12-27T06:40:16","slug":"installing-haproxy-on-ubuntu-14-04","status":"publish","type":"manual_kb","link":"https:\/\/support.aklwebhost.com\/knowledgebase\/installing-haproxy-on-ubuntu-14-04\/","title":{"rendered":"Installing HAProxy on Ubuntu 14.04"},"content":{"rendered":"

HAProxy is a network software application that offers high availability, load balancing, and proxying for TCP and HTTP network applications. It is suited for high traffic and powers many websites. This article will show you how to install and setup HAProxy on Ubuntu 14.04.<\/p>\n

Although HAProxy has several prominent features, this article focuses on how to setup HAProxy to “proxy” your web application.<\/p>\n

Installing HAProxy<\/h3>\n

Since Ubuntu 14.04 does not ship with HAProxy 1.5 (latest stable release at time of writing), we will have to use a PPA to be able to install it using\u00a0apt-get<\/code>:<\/p>\n

add-apt-repository ppa:vbernat\/haproxy-1.5\r\n<\/code><\/pre>\n

Next, update the system:<\/p>\n

apt-get update\r\napt-get dist-upgrade\r\n<\/code><\/pre>\n

Now install HAProxy with the following command:<\/p>\n

apt-get install haproxy\r\n<\/code><\/pre>\n

If everything is successful, then you have finished installing HAProxy and can proceed to the next step.<\/p>\n

Configuring HAProxy<\/h3>\n

The HA Proxy configuration file is split up into two sections \u2013 “global”, and “proxies”. One deals with process-wide configuration, while the other consists of default configuration, frontend, and backend sections.<\/p>\n

Global Section<\/h4>\n

With your favorite text editor, open\u00a0\/etc\/haproxy\/haproxy.cfg<\/code>\u00a0and you will notice the predefined sections: “global” and “defaults”. The first thing that you may want to do is increase the\u00a0maxconn<\/code>\u00a0to a reasonable size, as this affects the connections that HAProxy allows. Too many connections may cause your web service to crash due to many requests. You will need to adjust the size to see what works for you. In the global section, add or change\u00a0maxconn<\/code>\u00a0to 3072.<\/p>\n

In the default section, add the following lines under\u00a0mode http<\/code>:<\/p>\n

option forwardfor\r\noption http-server-close\r\n<\/code><\/pre>\n

This will add\u00a0X-Forwarded-For<\/code>\u00a0headers to each request, as well as reduce the latency between HAProxy and to preserve client persistent connections.<\/p>\n

Proxies Section<\/h4>\n
Frontend and Backend<\/h5>\n

Commonly, the first thing when it comes to using is to setup a frontend to handle HTTP connections. Add the following:<\/p>\n

frontend http-frontend\r\n    bind public_ip:80\r\n    reqadd X-Forwarded-Proto:\\ http\r\n    default_backend wwwbackend\r\n<\/code><\/pre>\n

Note:<\/strong>\u00a0Be sure to replace\u00a0public_ip<\/code>\u00a0with your domain or your public ip. Otherwise, this entire setup will not work.<\/p>\n

After you have finished configuring the frontend, you can now add your backend by adding the following lines to the end of your configuration:<\/p>\n

backend wwwbackend\r\n    server 1-www private_ip_1:80 check\r\n    server 2-www private_ip_2:80 check\r\n    server 3-www private_ip_3:80 check\r\n<\/code><\/pre>\n

The backend configuration used here creates a connection named\u00a0X-www<\/code>\u00a0to\u00a0private_ip_X:80<\/code>\u00a0(Replace X with 1 \u2013 3. and replace\u00a0private_ip_X<\/code>\u00a0with your private or public ip). This will allow you to load balance between each server set (assuming you have more than one server). The\u00a0check<\/code>\u00a0option makes the load balancer perform health checks on the server.<\/p>\n

When you are done, save the configuration file, then restart HAProxy by running:<\/p>\n

service haproxy restart\r\n<\/code><\/pre>\n

If everything is working, then you will be able to connect to\u00a0http:\/\/public_ip\/<\/code>\u00a0(replacing it with your AKLWEB Host VPS IP) and view your website.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","manualknowledgebasecat":[109,242,247],"manual_kb_tag":[431],"_links":{"self":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2847"}],"collection":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/comments?post=2847"}],"version-history":[{"count":3,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2847\/revisions"}],"predecessor-version":[{"id":2850,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2847\/revisions\/2850"}],"wp:attachment":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/media?parent=2847"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manualknowledgebasecat?post=2847"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb_tag?post=2847"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}