Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk10 min

How to Run Multiple HAProxy Instances on a Linux VPS

A practical systemd guide to running multiple independent HAProxy process trees on one Linux VPS, including listener planning, unique paths, master-worker reloads, socket security and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run one HAProxy process tree per systemd unit, and give every instance its own configuration file, PID file, runtime directory, control sockets, state paths, and listener addresses. Start each service in master-worker mode with -Ws, validate its configuration before reloading, and send reload signals only to that instance. The result is independent lifecycle control: a failure or reload in site-a does not have to stop site-b.

What “multiple HAProxy instances” means

Each instance is a separate HAProxy master process with its own worker processes, configuration, PID file and systemd service. For example, haproxy-site-a.service can terminate TLS for one application while haproxy-site-b.service proxies another. They may run on the same VPS, but they do not share listener sockets or control files.

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.

This is different from putting several frontends and backends in one haproxy.cfg. A single process can serve many applications, but all of those applications share its reload boundary, process limits and failure domain. Separate services are useful when teams need independent deployments, certificates or rollback schedules.

Choose separate services or one larger configuration

Consideration Separate HAProxy instances One HAProxy instance
Reload and failure isolation Each systemd unit can be validated, restarted or reloaded independently. One reload affects every frontend and backend in the configuration.
Listener allocation Every address-and-port pair must be unique across all services. One process owns the listener set and can route by SNI, host header or path.
Certificates, maps and state Ownership is explicit, but names and paths must not collide. Shared naming is simpler, provided the single configuration remains disciplined.
Operational overhead More unit files, logs, sockets and process trees to monitor. Fewer services and less duplicated process overhead.
Resource use Each process tree adds memory and file descriptors; size limits for the aggregate workload. Lower duplicated overhead, but all traffic shares one process boundary.
Observability Independent master and stats sockets make per-service inspection straightforward. One control plane covers every proxy.

If applications can share one public port and a common policy, a single HAProxy configuration is usually simpler. Use separate instances when isolation is more important than minimizing process overhead.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Plan the instance layout before installing services

Reserve listeners

Write down every address and port before creating units. No two HAProxy processes may bind the same <address>:<port> pair. Two services can use the same port number only if they bind different local IP addresses. Otherwise, place one front door on the public port and route internally.

Instance Configuration PID file Master socket Example listener
site-a /etc/haproxy/site-a/haproxy.cfg /run/haproxy-site-a/haproxy.pid /run/haproxy-site-a/master.sock 0.0.0.0:443
site-b /etc/haproxy/site-b/haproxy.cfg /run/haproxy-site-b/haproxy.pid /run/haproxy-site-b/master.sock 0.0.0.0:8443

The addresses above are examples. Replace them with ports and local IPs actually available on your VPS.

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

Create separate persistent and transient directories

Keep configuration under a per-instance directory such as /etc/haproxy/site-a/ and /etc/haproxy/site-b/. Put runtime state under matching directories in /var/lib/haproxy/, for example /var/lib/haproxy/site-a/. Use a different runtime directory under /run/ for each service.

systemd’s RuntimeDirectory= is intended for this transient area: it creates the directory for the unit and cleans it up with the unit’s runtime lifecycle. Do not store certificates, maps or durable state only under /run, because that filesystem is normally recreated at boot.

Make names unique

Give each instance distinct names for certificates, maps, state files, PID files and sockets. If you use relative paths or HAProxy’s default-path, set an instance-specific prefix. HAProxy warns that shared names can make runtime updates ambiguous, especially when a map or certificate is changed through a socket.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Install prerequisites and verify the packaged unit

Install HAProxy from your distribution and confirm the binary location, package version and service defaults. The examples below use /usr/sbin/haproxy, but some distributions package it elsewhere. Inspect the installed unit before copying it: the official template exposes the variables CONFIG, PIDFILE, CFGDIR and EXTRAOPTS, and distributions may add hardening or different reload commands.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Have root or equivalent privileges for files under /etc, /var/lib and /run.
  • Ensure each planned listener address is assigned to the VPS.
  • Ensure the HAProxy service account can read configuration, certificates, maps and state files.
  • Check that your VPS has enough file descriptors and connection capacity for all services together.

Create per-instance configuration files

Start by copying a known-good configuration and change every path and listener that belongs to the new service. A minimal configuration for site-a might look like this:

global
    log /dev/log local0
    log /dev/log local1 notice
    stats socket /run/haproxy-site-a/stats.sock mode 660 level admin

defaults
    mode http
    timeout connect 5s
    timeout client 30s
    timeout server 30s

frontend site_a_https
    bind 0.0.0.0:443
    default_backend site_a_servers

backend site_a_servers
    server app1 127.0.0.1:9001 check

The corresponding site-b file must use its own listener and socket paths:

global
    log /dev/log local0
    log /dev/log local1 notice
    stats socket /run/haproxy-site-b/stats.sock mode 660 level admin

defaults
    mode http
    timeout connect 5s
    timeout client 30s
    timeout server 30s

frontend site_b_https
    bind 0.0.0.0:8443
    default_backend site_b_servers

backend site_b_servers
    server app1 127.0.0.1:9002 check

The stats socket directive is optional and is not enabled by default. Add it in the global section only when you need the runtime statistics interface. Never point two configurations at the same socket path.

For TLS, use certificate files that the relevant service can read and give each instance a clear certificate and map naming scheme. A certificate can be physically shared when permissions and change control allow it, but the paths, map names and runtime operations should still be unambiguous.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Create one systemd unit per HAProxy instance

Option 1: named units

Create a unit for site-a at /etc/systemd/system/haproxy-site-a.service. This pattern follows the packaged master-worker design; verify the exact binary path and reload behavior on your distribution.

[Unit]
Description=HAProxy site-a
After=network-online.target
Wants=network-online.target

[Service]
Environment="CONFIG=/etc/haproxy/site-a/haproxy.cfg" 
            "PIDFILE=/run/haproxy-site-a/haproxy.pid" 
            "EXTRAOPTS=-S /run/haproxy-site-a/master.sock"
ExecStart=/usr/sbin/haproxy -Ws -f $CONFIG -p $PIDFILE $EXTRAOPTS
ExecReload=/usr/sbin/haproxy -Ws -f $CONFIG -c
ExecReload=/bin/kill -USR2 $MAINPID
Type=notify
Restart=always
RuntimeDirectory=haproxy-site-a

Create haproxy-site-b.service with the same structure, replacing every site-a path and description with site-b. Its CONFIG, PIDFILE, EXTRAOPTS and RuntimeDirectory must all be different.

-W selects master-worker mode and -s enables systemd notification; together, -Ws lets systemd supervise the HAProxy master while workers handle traffic. The -S option creates a master CLI socket for that process tree.

Option 2: a template unit

A template such as [email protected] can reduce duplication, but the instance name must be safely converted into paths. For example, [email protected] should resolve to /etc/haproxy/site-a/haproxy.cfg, /run/haproxy-site-a/haproxy.pid and /run/haproxy-site-a/master.sock. Test the generated paths for every allowed instance name before enabling the template. If your distribution already ships a template, adapt it instead of replacing its hardening and dependency settings.

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

Enable and start the services safely

  1. Create the directories and place each configuration file in its corresponding /etc/haproxy/<instance>/ directory.
  2. Place durable maps, certificate references and state files under that instance’s configuration or /var/lib/haproxy/<instance>/ directory.
  3. Set ownership and permissions so the HAProxy account can read required files while private keys remain restricted.
  4. Ask systemd to reread unit files with systemctl daemon-reload.
  5. Validate each configuration independently:
    haproxy -c -f /etc/haproxy/site-a/haproxy.cfg
    haproxy -c -f /etc/haproxy/site-b/haproxy.cfg
  6. Start one service and confirm its listener before starting the next:
    systemctl enable --now haproxy-site-a
    systemctl enable --now haproxy-site-b
  7. Check the result with systemctl status haproxy-site-a and systemctl status haproxy-site-b.

Configuration checking catches syntax and file-reference problems, but it does not prove that a port is free or that an upstream application is healthy. Confirm both the bind operation and backend checks after startup.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Reload one instance without interrupting the others

Always validate the target file before reloading. For site-a:

haproxy -c -f /etc/haproxy/site-a/haproxy.cfg
systemctl reload haproxy-site-a

The reload must address only haproxy-site-a; do not run a global command that signals every HAProxy process on the VPS. With the master-worker unit pattern, systemd sends USR2 to that unit’s master process. The master starts new workers with the new configuration while existing workers finish current sessions, providing a graceful handoff when the configuration and process limits permit it.

For a manually managed process, HAProxy documents the PID-file pattern: start with -p, then notify the old process IDs with -sf $(cat PIDFILE). Each instance must have its own PID file, and the command must read the PID file belonging to the service being replaced. Under systemd, prefer the packaged master-worker reload mechanism rather than mixing manual signals and unit operations.

After reloading, inspect the unit and its journal:

systemctl status haproxy-site-a
journalctl -u haproxy-site-a --since "5 minutes ago"

Then query the site-a master or stats socket. A socket client such as socat must use the matching path, for example /run/haproxy-site-a/master.sock; using site-b‘s socket would inspect the wrong process tree.

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

Operate the master and stats sockets separately

The master CLI is a socket bound to the master process in master-worker mode. Give each instance a distinct -S path. It can address individual HAProxy processes, which is useful when checking workers or performing runtime operations.

The statistics socket is a separate interface configured with stats socket in the global section. HAProxy’s management documentation explicitly notes that this socket is not enabled by default. If you enable it, choose a unique path, mode and access group for each service, and protect it because administrative commands can change live traffic handling.

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

Use filesystem permissions and, where appropriate, a dedicated group to limit who can open each socket. Do not expose these UNIX sockets through a world-writable directory or reuse one socket path between units.

Keep logs, maps and state from colliding

  • Logs: give each service a recognizable syslog identity or route its unit journal separately, so operators can distinguish events during an incident.
  • Maps: store maps under the owning instance and use unique filenames. Runtime map commands should be sent to that instance’s socket only.
  • Certificates: reference the intended certificate bundle from the correct configuration and verify permissions after certificate rotation.
  • State files: put stick-table or server-state files in the instance’s own persistent directory when enabled.
  • Relative paths: set an instance-specific default-path or use absolute paths to avoid one service resolving a filename in another service’s directory.

Resource sizing on a shared VPS

Every listener consumes a socket and therefore a file descriptor. Frontend connections, backend connections, health checks, logs, control sockets and TLS activity add to the total. Calculate limits for all instances together rather than checking each service in isolation. Review the service account’s file-descriptor limit, the system-wide limit, available memory and the VPS provider’s connection or process quotas.

Separate instances duplicate master and worker process overhead. That cost may be worthwhile for isolation, but a small VPS can run out of memory or descriptors sooner than expected. If aggregate limits are tight, consolidate compatible frontends into one HAProxy process or move one service to another VPS. Increase limits only after measuring the workload and confirming that the host can sustain the additional connections.

Troubleshooting by symptom

“Address already in use” on startup

  • List every bind directive across all configuration files and look for the same address-and-port pair.
  • Check whether an old process still owns the port with your operating system’s socket tools.
  • If both services need the same numeric port, assign different local IP addresses or introduce one front door that routes to both applications.

The unit starts, then exits

  • Run haproxy -c -f against that instance’s file and correct syntax, missing certificates, maps or state paths.
  • Read only that unit’s journal with journalctl -u haproxy-site-a.
  • Confirm the configured PID and runtime directories exist or are created by RuntimeDirectory=, and that permissions allow HAProxy to create its PID and sockets.

Reload affects the wrong service

  • Check that the command targets the correct unit name rather than a generic haproxy.service.
  • Verify the unit’s MAINPID, PID file and master socket all belong to the same instance.
  • Remove scripts that search for every HAProxy PID and replace them with the unit’s native reload operation.

The socket cannot be opened

  • Confirm that the configuration actually enables a stats socket; it is disabled by default.
  • Use the exact per-instance path and check directory, socket and group permissions.
  • Make sure the service has not been restarted, which can remove transient paths under /run; query the newly created socket after startup.

Runtime map or certificate changes are ambiguous

Look for duplicate filenames, relative paths or shared socket commands. Give the resource a unique path and send the update through the master or stats socket belonging to the intended service. If the change still cannot be safely scoped, perform a validated configuration reload for that instance instead of a runtime mutation.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Operational checklist

  • Each service has its own configuration, PID file, runtime directory and master socket.
  • Every listener address-and-port pair is unique across the VPS.
  • Stats sockets are explicitly enabled, uniquely named and permission-protected.
  • Certificates, maps and state files have unambiguous ownership and readable permissions.
  • Every configuration passes haproxy -c -f before startup or reload.
  • Reloads use the target systemd unit and its master-worker process, not a host-wide signal.
  • Status, journal and socket checks are performed per instance.
  • Aggregate memory, process, connection and file-descriptor limits are sufficient.
  • The actual HAProxy binary path and distribution-provided unit defaults have been verified.

When a single instance is the better design

Use one configuration when the services can share a public listener, certificates and operational ownership, and when a common reload boundary is acceptable. HAProxy can route many applications from one process using separate frontends and backends, avoiding duplicated process overhead and reducing the number of sockets and units to monitor.

Use separate instances when independent teams need to deploy or restart their proxy, when configuration failures must be isolated, or when certificate, map and policy ownership must be kept strictly separate. The additional directories, units and resource consumption are the price of that boundary.

Final decision

The reliable pattern is one systemd-managed master-worker tree per HAProxy instance, with no shared listener or control path. Clone the distribution unit or create a template, assign unique configuration, PID, runtime, state and socket paths, validate before every reload, and operate each service through its own unit. That arrangement lets you reload one proxy gracefully while the other instances continue serving their traffic.

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.

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.

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
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

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.