Would you like to learn how to install Haproxy on Ubuntu Linux?In this tutorial, we are going to show you all the steps required to perform the Haproxy installation on Ubuntu Linux in 5 minutes or less.
• Ubuntu 18.04
• Ubuntu 19.10
• Haproxy 2.0.5
In our example, the Haproxy server will receive HTTP connection on the external IP address and perform the loadbalance between 2 internal web servers.
• Haproxy load balancer external IP address : 200.200.200.200
• Haproxy load balancer internal IP address : 192.168.10.1
• Webserver #01 IP address: 192.168.10.5
• Webserver #02 IP address: 192.168.10.6
Haproxy Related Tutorial:
On this page, we offer quick access to a list of tutorials related to Haproxy linux.
Tutorial – HaProxy Installation on Ubuntu Linux
Install the Haproxy service.
Edit the haproxy.cfg configuration file.
Here is the haproxy.cfg configuration file, before our configuration.
Insert the following lines at the end of the haproxy.cfg file.
Here is the haproxy.cfg configuration file, after our configuration.
Use the following command to test configuration file named haproxy.cfg.
Restart the Haproxy service.
You have finished the Haproxy configuration on Ubuntu LInux.
Ubuntu – Accessing the HAproxy Web Server
After finishing installation, you need to test your Haproxy configuration.
Open a browser software and enter the external IP address of your Haproxy server.
In our example, the following URL was entered in the Browser:
• http://200.200.200.200
One of the internal webserver should answer your request.
In our example, we created a basic HTML page named test.hml to identify which server is answering the HTTP request.
When a user try to access http://200.200.200.200/test.html, the first server shows:
When a user try to access http://200.200.200.200/test.html, the second server shows:
You have finished the Haproxy installation on Ubuntu LInux.