DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk8 min

How to Install HAProxy on Ubuntu 22.04 (Jammy)

A complete Ubuntu 22.04 guide to installing HAProxy, configuring frontends and backends with health checks, validating the service, and troubleshooting listener or backend errors.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On Ubuntu 22.04, install the community HAProxy package with sudo apt update followed by sudo apt install haproxy. HAProxy then reads /etc/haproxy/haproxy.cfg. Add a frontend that listens for client traffic and a backend containing your application servers, validate the configuration, restart the service, and enable it at boot.

What you install on Ubuntu 22.04

Ubuntu 22.04, also called Jammy Jellyfish, provides HAProxy through its normal APT repositories. The package is the free community edition and is described by Ubuntu as a load-balancing reverse proxy. A Jammy security-archive entry observed in 2026 showed package version 2.4.30-0ubuntu0.22.04.2; the revision can change when Ubuntu publishes later security updates.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The installation gives you the HAProxy executable, a systemd service named haproxy, and the main configuration file at /etc/haproxy/haproxy.cfg. The service is ordered after network-online.target and is installed in the multi-user.target boot stage, so it can start automatically after networking is available when you enable it.

Before you begin

  • A running Ubuntu 22.04 server with an account that can use sudo.
  • Network reachability from the Ubuntu host to each backend address and port.
  • A free listener port, normally TCP port 80 for an HTTP reverse proxy. Do not use port 80 if another local service already owns it.
  • Firewall rules that allow client traffic to the HAProxy listener and HAProxy traffic to the backend servers.
  • The backend IP addresses or DNS names and ports. The addresses in the examples below, 10.0.0.11 and 10.0.0.12, are illustrative and must be replaced with reachable servers.

HAProxy does not create an application server. You need at least one service listening behind it if you want proxied requests to succeed.

#1 Best Overall
Alta Labs Route10 | 10 Gig Multi-WAN Router | High-Performance Qualcomm Quad-Core Hardware-Accelerated VPN Router | 2 10 Gbps SFP+ and 4 2.5 Gbps Ports | Real-Time Stats | Load Balancing | 40W PoE+
  • Professional 10Gbps Wired Routing – Route10 is a high-performance 10 Gigabit wired router designed for advanced home, business, and enterprise networks; it does not broadcast Wi-Fi, and wireless coverage requires pairing with one or multiple Wi-Fi access points such as ceiling, wall, or outdoor access points for full network coverage.
  • Quad-Core Qualcomm Network Accelerator for High Throughput – Powered by a high-performance quad-core Qualcomm processor with hardware-accelerated networking, the Route10 delivers fast packet processing, low latency, and consistent multi-gigabit performance for routing, firewall rules, VPN traffic, VLAN segmentation, and high-bandwidth network workloads without bottlenecks.
  • Integrated PoE+ Output to Power Network Devices – Select Ethernet ports provide Power over Ethernet Plus (PoE+) support, allowing the router to power compatible access points, network devices, or edge hardware directly through the Ethernet cable, reducing the need for additional power adapters or injectors.
  • Enterprise-Grade Routing, Firewall, and Network Control – Supports advanced routing features including VLAN tagging, QoS traffic prioritization, NAT port forwarding, firewall rules, DHCP services, and professional network segmentation for secure, reliable, and scalable wired network deployments.
  • Real-Time Network Monitoring and Traffic Visibility – Provides live network statistics and real-time monitoring of bandwidth usage, connected devices, WAN and LAN traffic, and system performance, allowing network administrators to quickly identify issues, optimize traffic flow, and maintain stable, high-performance wired networks.

Install HAProxy with APT

  1. Confirm the operating system. Run cat /etc/os-release and check that it identifies Ubuntu 22.04. This prevents applying Jammy package assumptions to another release.
  2. Refresh package metadata.
    sudo apt update

    APT downloads the current package indexes. If this step reports a repository or DNS error, fix that before attempting the installation.

  3. Install the package.
    sudo apt install haproxy

    Review the package list and confirm the prompt. APT resolves the dependencies and places the HAProxy service and its configuration under the standard system locations.

  4. Check the installed version if needed.
    haproxy -v

    The displayed version is the revision currently selected by your configured Jammy repositories, not a permanent version guarantee.

The normal community-package path requires no separate license key or vendor repository. HAProxy Enterprise is a different, licensed distribution channel; its Ubuntu 22.04 instructions require an enterprise key and a separate repository, so do not mix those steps with the community installation above.

Understand the files and service

Main configuration file

Edit /etc/haproxy/haproxy.cfg. The systemd service starts HAProxy with this path, so changing a file elsewhere will not affect the service unless you explicitly create a different unit or command line.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Service controls

Use systemctl to control the daemon:

Purpose Command
Start now sudo systemctl start haproxy
Stop now sudo systemctl stop haproxy
Restart after a configuration change sudo systemctl restart haproxy
Show current state and recent diagnostics sudo systemctl status haproxy
Start automatically during boot sudo systemctl enable haproxy
Remove boot-time enablement sudo systemctl disable haproxy

Run status after starting or restarting. A failed unit usually includes the reason in the same output; configuration parsing errors are often shown there or in the system journal.

Create a minimal HTTP reverse proxy and load balancer

HAProxy separates the client-facing listener from the servers that receive forwarded requests. A frontend accepts connections, and a backend chooses a server. The following pattern listens on every local interface on TCP port 80 and distributes HTTP requests between two backends:

Rank #2
Ubiquiti UXG-Enterprise 25G Independent Gateway featuring Multi-WAN Load Balancing, 12.5 Gbps IDS/IPS Routing, and Redundant Hot-Swap Power Supplies
  • Compatible management via CloudKey, Official UniFi Hosting, or UniFi Network Server running version 8.3.32 or newer
  • Ensures continuous connection through Shadow Mode High Availability featuring automatic failover (VRRP)
  • Delivers 12.5 Gbps routing performance equipped with IDS/IPS capabilities
  • Offers license-free, real-time decryption and inspection of encrypted traffic using NeXT AI Inspection*
  • Features 25G SFP28, 10G SFP+, and 2.5 GbE RJ45 ports where two interfaces can be reconfigured as WAN connections
frontend http
    bind *:80
    mode http
    default_backend web-backend

backend web-backend
    balance roundrobin
    server web1 10.0.0.11:80 check
    server web2 10.0.0.12:80 check

Open the file with an editor, for example:

sudo nano /etc/haproxy/haproxy.cfg

Keep any global or defaults sections that Ubuntu supplied unless you have a specific reason to replace them. Add the frontend and backend definitions in a syntactically valid location, then save the file.

What each directive does

  • frontend http names the client-side proxy section. The name is an internal label and can be changed.
  • bind *:80 listens on port 80 on all local interfaces. Bind a specific address instead when the host has multiple interfaces and should accept traffic on only one of them.
  • mode http tells HAProxy to process HTTP traffic at the application layer. The backend protocol and application must match this choice.
  • default_backend web-backend sends requests that arrive at this frontend to the named backend.
  • balance roundrobin selects servers in rotation. With two similarly capable servers, successive new requests are distributed between them; it does not guarantee that every client request uses a different server.
  • Each server line supplies a name, destination address, destination port, and the optional check keyword.

Choosing backend addresses

Replace the example private addresses with the actual addresses that the Ubuntu host can reach. Test the path from the HAProxy host, not from your workstation; a backend may be reachable from one network but blocked from the proxy’s network. If your applications listen on another port, use that port on each server line.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why add check

With check, HAProxy performs an active TCP-layer health check. A basic check succeeds when the server answers the connection handshake. A server that fails the check is removed from load-balancing rotation and can be returned when later checks succeed. This prevents new traffic from being sent to a host that is not accepting connections, although a successful TCP handshake does not prove that the application returned a correct HTTP response.

Validate before applying the configuration

Do not use a blind restart after editing. Ask the installed binary to parse the exact file first:

Rank #3
Titan Networx - Hardwired Router TNGR-4000
  • Hardwired Router
  • Titan Networx
  • High performance router
  • managed switch
  • integrated router
sudo haproxy -c -f /etc/haproxy/haproxy.cfg

A successful check reports that the configuration is valid. If it reports an error, note the line number, correct the directive or indentation, and run the check again. Common causes include a misspelled section name, a duplicate listener address, an invalid server address, and a backend name in default_backend that does not exist.

Once validation succeeds, apply the change and inspect the service:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo systemctl restart haproxy
sudo systemctl status haproxy

Enable automatic startup separately:

sudo systemctl enable haproxy

Enabling does not replace a restart; it records the boot-time relationship. Restarting applies the current configuration immediately.

Test the listener and backend path

  1. From the HAProxy host, verify that the process is listening on the selected port with sudo ss -ltnp | grep ':80'. If nothing is listening, inspect systemctl status haproxy and the validation output.
  2. From a client that can reach the proxy, request the listener address, for example curl -i http://proxy-address/. Replace proxy-address with the proxy’s DNS name or IP; it is a shell argument, not a literal hostname requirement.
  3. Check the backend directly from the Ubuntu host, such as curl -i http://10.0.0.11/, when the application speaks HTTP. This distinguishes an application or network problem behind HAProxy from a listener problem on the proxy.
  4. Review systemctl status haproxy immediately after a failed request. A running process with no response often points to firewall rules, an unreachable backend, or an application that is listening on a different address or port.

Allow the listener through any host firewall and permit the outbound backend connections. Network security groups, upstream firewalls, and the backend host firewall all need to allow the relevant direction of traffic.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common installation and configuration failures

Symptom Likely cause Correction
Unable to locate package haproxy APT indexes are stale, repositories are unavailable, or the host is not using the expected Ubuntu repositories. Run sudo apt update, read the repository error, and verify /etc/os-release reports Ubuntu 22.04.
Validation says a port is already in use Another service is bound to *:80 or to the address and port in your bind line. Find the owner with sudo ss -ltnp; stop or reconfigure that service, or choose an unused HAProxy listener port.
Service fails immediately after restart HAProxy rejected the configuration or cannot bind the listener. Run sudo haproxy -c -f /etc/haproxy/haproxy.cfg, then inspect sudo systemctl status haproxy for the specific line or socket error.
Clients receive connection refused HAProxy is stopped, the listener is on another address or port, or a firewall blocks access. Confirm the service is active, check the bind directive, verify with ss, and open the intended firewall path.
Clients receive a gateway or backend error No backend is healthy or the proxy cannot reach the configured server address and port. Test each backend from the proxy host, verify the application is listening, and check that the server line uses the correct port. The check keyword will keep failed servers out of rotation.
Only one server receives traffic The other server fails its health check, is unreachable, or the test consists of a single persistent connection. Check backend connectivity and application logs. Use multiple new requests when assessing round-robin distribution.
Changes appear to have no effect The edited file was not /etc/haproxy/haproxy.cfg, or the service was not restarted after validation. Validate that exact path and run sudo systemctl restart haproxy.

Community package versus HAProxy Enterprise

For a normal Ubuntu 22.04 deployment, the community package is the straightforward default. Enterprise is a separate product channel rather than an alternate command for the same APT installation.

Aspect Ubuntu community package HAProxy Enterprise
License and entitlement Free community package supplied through Ubuntu’s repositories. Licensed distribution requiring an enterprise key.
Repository Standard Jammy APT package source. Separate enterprise repository setup.
Updates Ubuntu package revisions and security updates, including revisions after the observed 2.4.30-0ubuntu0.22.04.2 entry. Enterprise channel and its support/update terms.
Support and modules Community software and Ubuntu packaging; enterprise-only support and modules are not included. Enterprise support entitlement and included enterprise modules depend on the licensed offering.
Compatibility work Designed for the Ubuntu 22.04 package flow described here. Follow the vendor’s Ubuntu 22.04 repository and key requirements rather than substituting community commands.

Operational checklist after installation

  • Keep the configuration under change control so edits can be reviewed and reverted.
  • Run the parser check before every restart: sudo haproxy -c -f /etc/haproxy/haproxy.cfg.
  • Confirm that the listener port is not shared with another daemon.
  • Verify each backend from the proxy host and keep check enabled where a TCP availability check reflects your failure policy.
  • Permit only the required client-to-proxy and proxy-to-backend firewall paths.
  • After a package update, inspect the installed version with haproxy -v and revalidate the configuration before restarting.
  • Use systemctl status haproxy after changes and during incident diagnosis; a process being active does not by itself prove that any backend is healthy.

Essential command sequence

For a new Jammy host with backend addresses ready, the shortest safe sequence is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apt update
sudo apt install haproxy
sudo nano /etc/haproxy/haproxy.cfg
sudo haproxy -c -f /etc/haproxy/haproxy.cfg
sudo systemctl restart haproxy
sudo systemctl status haproxy
sudo systemctl enable haproxy

The installation is complete when the configuration check succeeds, the service remains active after restart, the listener accepts connections, and at least one configured backend passes its health check.

Quick Recap

Bestseller No. 2
Ubiquiti UXG-Enterprise 25G Independent Gateway featuring Multi-WAN Load Balancing, 12.5 Gbps IDS/IPS Routing, and Redundant Hot-Swap Power Supplies
Ubiquiti UXG-Enterprise 25G Independent Gateway featuring Multi-WAN Load Balancing, 12.5 Gbps IDS/IPS Routing, and Redundant Hot-Swap Power Supplies
Delivers 12.5 Gbps routing performance equipped with IDS/IPS capabilities; Includes two hot-swappable power supplies to guarantee power redundancy
$2,014.24
Bestseller No. 3
Titan Networx - Hardwired Router TNGR-4000
Titan Networx - Hardwired Router TNGR-4000
Hardwired Router; Titan Networx; High performance router; managed switch; integrated router
$316.00

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.