{"id":6061,"date":"2020-06-06T00:26:41","date_gmt":"2020-06-05T21:26:41","guid":{"rendered":"https:\/\/kifarunix.com\/?p=6061"},"modified":"2024-03-14T21:55:45","modified_gmt":"2024-03-14T18:55:45","slug":"install-and-setup-haproxy-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-and-setup-haproxy-on-ubuntu-20-04\/","title":{"rendered":"Install and Setup HAProxy on Ubuntu 20.04"},"content":{"rendered":"\n<p>Welcome to our guide on how to install and setup HAProxy on Ubuntu 20.04. <a rel=\"noreferrer noopener\" href=\"http:\/\/www.haproxy.org\/\" target=\"_blank\">HAProxy<\/a> (<strong>H<\/strong>igh <strong>A<\/strong>vailability Proxy), as you might already be aware, is a free,&nbsp;very&nbsp;fast and reliable solution offering&nbsp;high availability,&nbsp;load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for very high traffic web sites and powers quite a number of the world&#8217;s most visited ones. <\/p>\n\n\n\n<p>It features connection persistence through HTTP cookies, load balancing, header addition, modification, deletion both ways. It has request blocking capabilities and provides interface to display server status.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing HAProxy on Ubuntu 20.04<\/h2>\n\n\n\n<p>HAProxy is available on the default Ubuntu 20.04 repos. However, the available package might not be up-to-date.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt show haproxy<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Package: haproxy\nVersion: 2.0.13-2\nPriority: optional\nSection: net\nOrigin: Ubuntu\nMaintainer: Ubuntu Developers &lt;ubuntu-devel-discuss@lists.ubuntu.com&gt;\nOriginal-Maintainer: Debian HAProxy Maintainers &lt;haproxy@tracker.debian.org&gt;\nBugs: https:\/\/bugs.launchpad.net\/ubuntu\/+filebug\nInstalled-Size: 3,287 kB\nPre-Depends: dpkg (&gt;= 1.17.14)\nDepends: libc6 (&gt;= 2.17), libcrypt1 (&gt;= 1:4.1.0), libgcc-s1 (&gt;= 3.0), liblua5.3-0, libpcre2-8-0 (&gt;= 10.22), libssl1.1 (&gt;= 1.1.1), libsystemd0, zlib1g (&gt;= 1:1.1.4), adduser, lsb-base (&gt;= 3.0-6)\nSuggests: vim-haproxy, haproxy-doc\nHomepage: http:\/\/www.haproxy.org\/\nDownload-Size: 1,519 kB\nAPT-Sources: http:\/\/ke.archive.ubuntu.com\/ubuntu focal\/main amd64 Packages<\/code><\/pre>\n\n\n\n<p>As you can see, the HAProxy package available on the default repos is version 2.0.13 while the current stable release is version 2.1.5.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"createhaproxyubuntupparepos\"><a href=\"#createhaproxyubuntupparepos\">Create HAProxy PPA Repository for Ubuntu<\/a><\/h3>\n\n\n\n<p>There are however, PPA repos that provides the latest stable release versions of HAProxy maintained by <a rel=\"noreferrer noopener\" href=\"https:\/\/launchpad.net\/~vbernat\" target=\"_blank\">Vincent Bernat<\/a>. These PPA repos can be installed as follows;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>install software-properties-common<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>add-apt-repository ppa:vbernat\/haproxy-2.1 --yes<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Run system update<\/h3>\n\n\n\n<p>Once the PPA repos are added to system, update your system package cache;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt update<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"installhaproxyubuntu20.04\"><a href=\"#installhaproxyubuntu20.04\">Install HAProxy on Ubuntu 20.04<\/a><\/h3>\n\n\n\n<p>You can now be able to install the latest stable version of HAProxy;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt-cache policy haproxy<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>haproxy:\n  Installed: (none)\n  Candidate: 2.1.5-1ppa1~focal\n  Version table:\n     <strong>2.1.5-1ppa1~focal 500<\/strong>\n        500 http:\/\/ppa.launchpad.net\/vbernat\/haproxy-2.1\/ubuntu focal\/main amd64 Packages\n<strong>     2.0.13-2 500\n<\/strong>        500 http:\/\/ke.archive.ubuntu.com\/ubuntu focal\/main amd64 Packages<\/code><\/pre>\n\n\n\n<p>Note the versions provided by individual repos.<\/p>\n\n\n\n<p>You can now install HAProxy;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install haproxy<\/code><\/pre>\n\n\n\n<p>To check the version of installed HAProxy, run the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>haproxy -v<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>HA-Proxy version 2.1.5-1ppa1~focal 2020\/06\/01 - https:\/\/haproxy.org\/\nStatus: stable branch - will stop receiving fixes around Q1 2021.\nKnown bugs: http:\/\/www.haproxy.org\/bugs\/bugs-2.1.5.html\nRunning on: Linux 5.4.0-33-generic #37-Ubuntu SMP Thu May 21 12:53:59 UTC 2020 x86_64<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"haproxylbubuntu20.04\"><a href=\"#haproxylbubuntu20.04\">Configure HAProxy Load Balancer on Ubuntu 20.04<\/a><\/h3>\n\n\n\n<p>With HAProxy, you can define multiple proxy services and configure HAProxy to load balance the traffic for the defined proxies. Proxies are made up of frontend system and one or more back-end systems. The front-end system defines the IP address and port on which the proxy listens as well as the back-end systems to use for a particular proxy.<\/p>\n\n\n\n<p>The main configuration file for HAProxy is&nbsp;<strong><code>\/etc\/haproxy\/haproxy.cfg<\/code><\/strong>.<\/p>\n\n\n\n<p>The HAProxy configuration file is made up of four sections;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>global<\/code>: The global section defines process-wide security and performance tunings that affect HAProxy at a low level.<\/li>\n\n\n\n<li><code>defaults<\/code>: The global section defines the configuration settings that are applied to all of the&nbsp;<code>frontend<\/code>&nbsp;and&nbsp;<code>backend<\/code>&nbsp;sections. You can define multiple default sections but the sub-sequent defaults sections override that came before it.<\/li>\n\n\n\n<li><code>frontend<\/code>: When HAProxy is placed as a reverse proxy, the&nbsp;<code>frontend<\/code>&nbsp;section defines the IP addresses and ports that clients can connect to.<\/li>\n\n\n\n<li><code>backend<\/code>: The backend section defines the group of servers that will be load balanced and assigned to handle requests.<\/li>\n<\/ul>\n\n\n\n<p>The&nbsp;<code>frontend<\/code>&nbsp;and&nbsp;<code>backend<\/code>&nbsp;sections can be combined using the<code>&nbsp;listen<\/code>&nbsp;section. It can also be used to server&nbsp;<a href=\"https:\/\/www.haproxy.com\/blog\/exploring-the-haproxy-stats-page\/\" target=\"_blank\" rel=\"noreferrer noopener\">HAProxy statistics page<\/a>.<\/p>\n\n\n\n<p>Read more about these sections on <a rel=\"noreferrer noopener\" href=\"https:\/\/www.haproxy.com\/blog\/the-four-essential-sections-of-an-haproxy-configuration\/\" target=\"_blank\">Essential Sections of an HAProxy Configuration<\/a>.<\/p>\n\n\n\n<p>The default HAProxy file configuration looks like as shown below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code> grep -v '^\\s*#' \/etc\/haproxy\/haproxy.cfg<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>global\n\tlog \/dev\/log\tlocal0\n\tlog \/dev\/log\tlocal1 notice\n\tchroot \/var\/lib\/haproxy\n\tstats socket \/run\/haproxy\/admin.sock mode 660 level admin expose-fd listeners\n\tstats timeout 30s\n\tuser haproxy\n\tgroup haproxy\n\tdaemon\n\n\tca-base \/etc\/ssl\/certs\n\tcrt-base \/etc\/ssl\/private\n\n        ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384\n        ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256\n        ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets\n\ndefaults\n\tlog\tglobal\n\tmode\thttp\n\toption\thttplog\n\toption\tdontlognull\n        timeout connect 5000\n        timeout client  50000\n        timeout server  50000\n\terrorfile 400 \/etc\/haproxy\/errors\/400.http\n\terrorfile 403 \/etc\/haproxy\/errors\/403.http\n\terrorfile 408 \/etc\/haproxy\/errors\/408.http\n\terrorfile 500 \/etc\/haproxy\/errors\/500.http\n\terrorfile 502 \/etc\/haproxy\/errors\/502.http\n\terrorfile 503 \/etc\/haproxy\/errors\/503.http\n\terrorfile 504 \/etc\/haproxy\/errors\/504.http<\/code><\/pre>\n\n\n\n<p>In our configuration file, we will modify the above to include the <code><strong>frontend<\/strong><\/code> and <code><strong>backend<\/strong><\/code> sections.<\/p>\n\n\n\n<p>Before you can proceed, make a backup of the default config file;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cp \/etc\/haproxy\/haproxy.cfg{,.factory}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"haproxyfrontend\"><a href=\"#haproxyfrontend\">Define HAProxy Frontend Configuration Settings<\/a><\/h3>\n\n\n\n<p>As stated above, the&nbsp;<code>frontend<\/code>&nbsp;section defines the IP addresses and ports that clients can connect to (The IP address and ports on the HAProxy server itself). Therefore, this is how our frontend configuration is like;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>frontend\n        bind 192.168.57.8:443 ssl crt \/etc\/ssl\/certs\/haproxy.pem\n        default_backend webapps\n        option forwardfor<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>bind<\/code><\/strong>: Define one or more listening addresses and\/or ports in a frontend server.<\/li>\n\n\n\n<li><code><strong>ssl<\/strong>&nbsp;<strong>crt<\/strong><\/code>: Configures HAProxy SSL Termination and specifies the path to SSL\/TLS certificate.<\/li>\n\n\n\n<li><code><strong>default_backend<\/strong><\/code>:&nbsp;Specifies the backend to use when no &#8220;use_backend&#8221; rule has been matched.<\/li>\n\n\n\n<li><code><strong>option forwardfor<\/strong><\/code>: HAProxy operates in reverse-proxy mode. This option enable the backend servers to see the IP addresses of the clients instead of the IP address for HAProxy server.<\/li>\n<\/ul>\n\n\n\n<p>NOTE: <\/p>\n\n\n\n<p>In this demo, our proxied backends uses SSL\/TLS certificates. As such, instead of configuring each backend application to terminate its SSL\/TLS connection (<code>SSL Pass through<\/code>), we will configure HAProxy as an SSL\/TLS certificate termination point (<code>SSL Termination<\/code>).<\/p>\n\n\n\n<p>If you are not using SSL\/TLS termination, remove the SSL part of the bind line, <code><strong>ssl crt \/etc\/ssl\/certs\/haproxy.pem<\/strong><\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"haproxybackend\"><a href=\"#haproxybackend\">Define HAProxy Backend Configuration Settings<\/a><\/h3>\n\n\n\n<p>In this section, we will, in the basic form, define the HAProxy Scheduling Algorithms and the backend servers whose requests are being proxied\/load balanced.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>backend webapps\n        balance roundrobin\n        server  app01   192.168.59.6:80 check\n        server  app02   192.168.60.4:80 check<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>balance<\/strong>\u00a0parameter defines the load balancer scheduling algorithm.\n<ul class=\"wp-block-list\">\n<li><strong>roundrobin<\/strong>&nbsp;selects the servers in turns.<\/li>\n\n\n\n<li>Other common algorithms is&nbsp;<strong>leastconn<\/strong>&nbsp;which enabled the load balancer to forward request to servers with least connections.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>server<\/strong>\u00a0setting specify the servers available in the back end.\n<ul class=\"wp-block-list\">\n<li><strong>check&nbsp;<\/strong>option enables health checks on the server such that if one of them is down, requests are directed to the available backend servers.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"haproxystats\"><a href=\"#haproxystats\">Define HAProxy Statistics Configuration Settings<\/a><\/h3>\n\n\n\n<p>According to <a rel=\"noreferrer noopener\" href=\"https:\/\/www.haproxy.com\/blog\/exploring-the-haproxy-stats-page\/#:~:text=HAProxy%20also%20ships%20with%20a,%2C%20backend%2C%20and%20server%20basis.\" target=\"_blank\">HAProxy Stats page<\/a>, HAProxy ships with a dashboard called the <strong>HAProxy Stats page<\/strong> that shows an abundance of metrics covering the health of the servers, current request rates, response times, and more. These metrics gives granular data on a per-frontend, backend, and server basis. This can be enabled using the <code>stats enable<\/code>&nbsp;directive,&nbsp;which can be added to either frontend or listen section. We used a listen section in this tutorial.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>listen stats\n        bind 192.168.57.8:8443 ssl crt \/etc\/ssl\/certs\/haproxy.pem\n        stats enable                    # enable statistics reports  \n        stats hide-version              # Hide the version of HAProxy\n        stats refresh 30s               # HAProxy refresh time\n        stats show-node                 # Shows the hostname of the node\n        stats auth haadmin:P@ssword     # Enforce Basic authentication for Stats page\n        stats uri \/stats                # Statistics URL<\/code><\/pre>\n\n\n\n<p>Note that the line, <code>bind 192.168.57.8:8443 ssl crt \/etc\/ssl\/certs\/haproxy.pem<\/code>, defines the frontend IP and port to access the HAProxy stats as well as the SSL\/TLS cert to use.<\/p>\n\n\n\n<p>Save and exit the file once done with configuration.<\/p>\n\n\n\n<p><a href=\"#haproxyconfigurationfile\" id=\"haproxyconfigurationfile\">In general, this is how our configuration is like<\/a>. <strong>NOTE<\/strong> that we added the line, <code>tune.ssl.default-dh-param 2048<\/code>, to SSL\/TLS configuration options section.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>global\n\tlog \/dev\/log\tlocal0\n\tlog \/dev\/log\tlocal1 notice\n\tchroot \/var\/lib\/haproxy\n\tstats socket \/run\/haproxy\/admin.sock mode 660 level admin expose-fd listeners\n\tstats timeout 30s\n\tuser haproxy\n\tgroup haproxy\n\tdaemon\n\n\tca-base \/etc\/ssl\/certs\n\tcrt-base \/etc\/ssl\/private\n\n        ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384\n        ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256\n        ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets\n       <code><strong>tune.ssl.default-dh-param 2048<\/strong><\/code>\n\ndefaults\n\tlog\tglobal\n\tmode\thttp\n\toption\thttplog\n\toption\tdontlognull\n        timeout connect 5000\n        timeout client  50000\n        timeout server  50000\n\terrorfile 400 \/etc\/haproxy\/errors\/400.http\n\terrorfile 403 \/etc\/haproxy\/errors\/403.http\n\terrorfile 408 \/etc\/haproxy\/errors\/408.http\n\terrorfile 500 \/etc\/haproxy\/errors\/500.http\n\terrorfile 502 \/etc\/haproxy\/errors\/502.http\n\terrorfile 503 \/etc\/haproxy\/errors\/503.http\n\terrorfile 504 \/etc\/haproxy\/errors\/504.http\n<strong>frontend kifarunixlb\n        bind 192.168.57.8:443 ssl crt \/etc\/ssl\/certs\/haproxy.pem\n        default_backend webapps\n        option forwardfor\nbackend webapps\n        balance roundrobin\n        server  app01   192.168.59.6:80 check\n        server  app02   192.168.60.4:80 check\nlisten stats\n        bind 192.168.57.8:8443 ssl crt \/etc\/ssl\/certs\/haproxy.pem\n        stats enable                    # enable statistics reports  \n        stats hide-version              # Hide the version of HAProxy\n        stats refresh 30s               # HAProxy refresh time\n        stats show-node                 # Shows the hostname of the node\n        stats auth haadmin:P@ssword     # Enforce Basic authentication for Stats page\n        stats uri \/stats                # Statistics URL<\/strong><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"haproxycheck\"><a href=\"#haproxycheck\">Validate HAProxy Configuration Syntax<\/a><\/h3>\n\n\n\n<p>Once done with configuration, run the command below to verify the HAProxy config syntax validation before you can start it;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>haproxy -f \/etc\/haproxy\/haproxy.cfg -c -V<\/code><\/pre>\n\n\n\n<p>If all is well, you should get the output;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>Configuration file is valid<\/code><\/pre>\n\n\n\n<p>Otherwise, you will get errors on stdout. Be sure to fix before you can proceed.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Running HAProxy<\/h4>\n\n\n\n<p>When installed, HAProxy is started and enabled to run on system boot by default. You can restart it by running the command below<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart haproxy<\/code><\/pre>\n\n\n\n<p>To check the status;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl status haproxy<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\u25cf haproxy.service - HAProxy Load Balancer\n     Loaded: loaded (\/lib\/systemd\/system\/haproxy.service; enabled; vendor preset: enabled)\n     Active: active (running) since Fri 2020-06-05 20:45:33 UTC; 7s ago\n       Docs: man:haproxy(1)\n             file:\/usr\/share\/doc\/haproxy\/configuration.txt.gz\n    Process: 21423 ExecStartPre=\/usr\/sbin\/haproxy -f $CONFIG -c -q $EXTRAOPTS (code=exited, status=0\/SUCCESS)\n   Main PID: 21425 (haproxy)\n      Tasks: 3 (limit: 2282)\n     Memory: 39.5M\n     CGroup: \/system.slice\/haproxy.service\n             \u251c\u250021425 \/usr\/sbin\/haproxy -Ws -f \/etc\/haproxy\/haproxy.cfg -p \/run\/haproxy.pid -S \/run\/haproxy-master.sock\n             \u2514\u250021440 \/usr\/sbin\/haproxy -Ws -f \/etc\/haproxy\/haproxy.cfg -p \/run\/haproxy.pid -S \/run\/haproxy-master.sock\n\nJun 05 20:45:33 haproxy.kifarunix-demo.com systemd&#91;1]: Starting HAProxy Load Balancer...\nJun 05 20:45:33 haproxy.kifarunix-demo.com haproxy&#91;21425]: Proxy kifarunixlb started.\nJun 05 20:45:33 haproxy.kifarunix-demo.com haproxy&#91;21425]: Proxy kifarunixlb started.\nJun 05 20:45:33 haproxy.kifarunix-demo.com haproxy&#91;21425]: Proxy webapps started.\nJun 05 20:45:33 haproxy.kifarunix-demo.com haproxy&#91;21425]: Proxy webapps started.\nJun 05 20:45:33 haproxy.kifarunix-demo.com haproxy&#91;21425]: Proxy stats started.\nJun 05 20:45:33 haproxy.kifarunix-demo.com haproxy&#91;21425]: Proxy stats started.\nJun 05 20:45:33 haproxy.kifarunix-demo.com haproxy&#91;21425]: &#91;NOTICE] 156\/204533 (21425) : New worker #1 (21440) forked\nJun 05 20:45:33 haproxy.kifarunix-demo.com systemd&#91;1]: Started HAProxy Load Balancer.<\/code><\/pre>\n\n\n\n<p>If UFW is running, Open port 443 as well as the statistics port;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ufw allow 443\/tcp<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ufw allow 8443\/tcp<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"verifyhaproxy\"><a href=\"#verifyhaproxy\">Verify HAProxy Load Balancing Setup on Ubuntu 20.04<\/a><\/h3>\n\n\n\n<p>You can now access your HAProxy from browser to confirm your LB setup. Use the address, <code><strong>https[s]:\/\/lb-server-IP-or-hostname<\/strong><\/code>.<\/p>\n\n\n\n<p>The first page shows content from the first defined backend, in this demo, app01. Remember the LB algorithm used here, <code><strong>roundrobin<\/strong><\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1295\" height=\"271\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/app01.png\" alt=\"haproxy roundrobin algorithm\" class=\"wp-image-6065\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/app01.png?v=1591391802 1295w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/app01-768x161.png?v=1591391802 768w\" sizes=\"(max-width: 1295px) 100vw, 1295px\" \/><\/figure>\n\n\n\n<p>If you reload the url, the content from the second app shows;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1308\" height=\"254\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/app02.png\" alt=\"haproxy load balancing\" class=\"wp-image-6066\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/app02.png?v=1591391850 1308w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/app02-768x149.png?v=1591391850 768w\" sizes=\"(max-width: 1308px) 100vw, 1308px\" \/><\/figure>\n\n\n\n<p>You can also check the statistics of your HAProxy, <code><strong>http[s]:\/\/lb-server-IP-or-hostname[:port]\/stats<\/strong><\/code>. If you enabled basic authentication, you are prompted to authenticate.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1155\" height=\"380\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/stats-auth.png\" alt=\"haproxy basic authentication\" class=\"wp-image-6067\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/stats-auth.png?v=1591391881 1155w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/stats-auth-768x253.png?v=1591391881 768w\" sizes=\"(max-width: 1155px) 100vw, 1155px\" \/><\/figure>\n\n\n\n<p>And there you got your statistics.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1912\" height=\"626\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/haproxy-stats.png\" alt=\"\" class=\"wp-image-6068\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/haproxy-stats.png?v=1591391907 1912w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/haproxy-stats-768x251.png?v=1591391907 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/haproxy-stats-1536x503.png?v=1591391907 1536w\" sizes=\"(max-width: 1912px) 100vw, 1912px\" \/><\/figure>\n\n\n\n<p>That brings us to the end of our tutorial on how to installing HAProxy on Ubuntu 20.04.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Further Reading<\/h3>\n\n\n\n<p><a href=\"https:\/\/cbonte.github.io\/haproxy-dconv\/2.0\/configuration.html\" target=\"_blank\" rel=\"noreferrer noopener\">HAProxy Configuration Manual<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Related Tutorials<\/h3>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-and-setup-haproxy-on-centos-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Setup HAProxy on CentOS 8<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/setup-haproxy-load-balancer-on-fedora-30-fedora-29\/\" target=\"_blank\" rel=\"noreferrer noopener\">Setup HAProxy Load Balancer on Fedora 30\/Fedora 29<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/kifarunix.com\/how-to-install-and-configure-pound-apache-load-balancer-on-ubuntu-16-04\/\" target=\"_blank\">How to Install and Configure Pound as Apache HTTP Load balancer on Ubuntu 16.04<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to our guide on how to install and setup HAProxy on Ubuntu 20.04. HAProxy (High Availability Proxy), as you might already be aware, is<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,1032,92],"tags":[1662,1033,1661,1659,1660,1200],"class_list":["post-6061","post","type-post","status-publish","format-standard","hentry","category-howtos","category-haproxy","category-load-balancers","tag-configure-haproxy-with-ssl-termination","tag-haproxy","tag-haproxy-ssl-termination","tag-install-haproxy-ubuntu-20-04","tag-setup-haproxy-load-balancer-on-ubuntu-20-04","tag-ubuntu-20-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/6061"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=6061"}],"version-history":[{"count":8,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/6061\/revisions"}],"predecessor-version":[{"id":21432,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/6061\/revisions\/21432"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=6061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=6061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=6061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}