HAProxy is a free, open-source, and reliable solution for load balancing web traffic. It is widely used in high traffic websites and provides powerful features such as SSL/TLS termination, TCP and HTTP routing, and more.
In this tutorial, we will explain how to install HAProxy on Clear Linux Latest.
Before we start installing HAProxy, it is recommended to update the Clear Linux packages to ensure that we have the latest packages installed. Use the following command to update the Clear Linux package:
sudo swupd update
To install HAProxy on Clear Linux latest, follow the steps:
Firstly, open the terminal and execute the following command to install the HAProxy:
sudo swupd bundle-add haproxy
After the installation process is complete, verify whether HAProxy is correctly installed or not. To verify, execute the following command:
haproxy -v
The output should display the version of the HAProxy.
After successful installation, we need to configure HAProxy to start using it. The HAProxy configuration file is located at /etc/haproxy/haproxy.cfg
. Use the following command to open it:
sudo nano /etc/haproxy/haproxy.cfg
Note: You can use any command-line text editor of your choice to open this file.
Here is the basic configuration for HAProxy:
global
maxconn 4096
user haproxy
group haproxy
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend http-in
bind *:80
default_backend servers
backend servers
mode http
balance roundrobin
server server1 127.0.0.1:8080 check
server server2 127.0.0.1:8081 check
This configuration will balance the web traffic between two backend servers. You can customize the configuration file according to your requirements.
After the configuration is done, save and close the file.
Once the HAProxy is installed and configured, we can start it to serve web traffic. Execute the following command to start HAProxy:
sudo systemctl start haproxy
To verify whether the HAProxy is started or not, execute the following command:
sudo systemctl status haproxy
If it is started successfully, the output should display active (running)
status.
In this tutorial, we explained how to install, configure and start HAProxy on Clear Linux latest. HAProxy provides an effective and efficient way to load balance web traffic. You can customize the HAProxy configuration according to your requirements.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!