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.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
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.
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.11and10.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
- 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
- Confirm the operating system. Run
cat /etc/os-releaseand check that it identifies Ubuntu 22.04. This prevents applying Jammy package assumptions to another release. - Refresh package metadata.
sudo apt updateAPT downloads the current package indexes. If this step reports a repository or DNS error, fix that before attempting the installation.
- Install the package.
sudo apt install haproxyReview the package list and confirm the prompt. APT resolves the dependencies and places the HAProxy service and its configuration under the standard system locations.
- Check the installed version if needed.
haproxy -vThe 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.
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
- 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 httpnames the client-side proxy section. The name is an internal label and can be changed.bind *:80listens 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 httptells HAProxy to process HTTP traffic at the application layer. The backend protocol and application must match this choice.default_backend web-backendsends requests that arrive at this frontend to the named backend.balance roundrobinselects 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
serverline supplies a name, destination address, destination port, and the optionalcheckkeyword.
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.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →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
- 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.
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
- From the HAProxy host, verify that the process is listening on the selected port with
sudo ss -ltnp | grep ':80'. If nothing is listening, inspectsystemctl status haproxyand the validation output. - From a client that can reach the proxy, request the listener address, for example
curl -i http://proxy-address/. Replaceproxy-addresswith the proxy’s DNS name or IP; it is a shell argument, not a literal hostname requirement. - 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. - Review
systemctl status haproxyimmediately 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.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
checkenabled 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 -vand revalidate the configuration before restarting. - Use
systemctl status haproxyafter 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:
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →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
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.




