October 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 PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk11 min

How to Upgrade NGINX In Place Without Dropping Connections

Upgrade NGINX without stopping service: validate the new binary, overlap generations with USR2, drain old workers with WINCH, and retire them with QUIT.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can replace an NGINX binary without intentionally dropping active connections by running the old and new master processes together, checking the new generation, draining the old workers with SIGWINCH, and retiring the old master with SIGQUIT. The handoff is controlled by signals, not by stopping the service.

The safe sequence is: validate the replacement, preserve the old executable and PID state, send SIGUSR2 to create the second generation, verify real traffic and workers, drain the old generation, then remove it. If the new binary fails, the retained old master and executable provide a rollback path.

As an Amazon Associate I earn from qualifying purchases.

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.

What an in-place NGINX upgrade actually changes

An NGINX upgrade replaces the executable used by the master and worker processes. A conventional service restart stops those processes first, which can close listening sockets and interrupt requests. An on-the-fly binary upgrade avoids that stop-start gap.

After SIGUSR2, the existing master renames its PID file with an .oldbin suffix and starts a new master from the replacement executable. The two generations overlap and can hold the same listening sockets. New workers can accept work while old workers finish requests that were already in progress.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

This does not make every connection immortal. A client can still experience an error caused by an application failure, an upstream timeout, a network interruption, a protocol-level close, or an incorrectly configured replacement. The upgrade procedure prevents the planned NGINX handoff from being the cause of a drop.

Signals and process states

Use the master-process PID, not a worker PID, for the handoff signals. The PID file location is defined by your NGINX build or configuration, so identify it before beginning.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Signal or action Target Effect When to use it
SIGUSR2 Current master Renames the current PID file to an .oldbin form and starts a new master and workers from the replacement executable. Begin the binary handoff after validation and installation.
SIGWINCH Old master recorded in the .oldbin PID file Asks old workers to shut down gracefully. They stop accepting new work and finish active requests and connections. Drain the old generation after the new one passes health checks.
SIGQUIT Old master Retires the old generation after its workers have drained. Complete the upgrade only after the new generation is demonstrably healthy.
SIGHUP Old master during rollback Starts the old workers again without rereading configuration, according to NGINX’s binary-upgrade procedure. Restore service with the old generation when the replacement is faulty.

Signals are asynchronous. Sending one does not prove that the requested state has already been reached; inspect process lists, PID files, logs, health checks, and representative traffic between stages.

Prepare before replacing the executable

Record the current state

Write down the running NGINX version, the master PID, the worker PIDs, the executable path, the configuration path, and the listening addresses and ports. Capture the currently loaded modules as well. A module compiled for a different NGINX version or build options can prevent the new binary from starting or can change request behavior after the handoff.

Keep a terminal or monitoring view open for process and application health. You need to distinguish the old master, the new master, and their workers once both generations exist.

Preserve rollback material

Copy the current executable to a protected rollback location before installing the replacement. Keep the existing master process and its .oldbin PID state until the upgrade is accepted. For a package-managed NGINX Plus deployment, back up the NGINX configuration and logs as part of the package runbook.

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

Do not overwrite the only copy of the old executable. If the replacement fails after SIGUSR2, the old master can only restart old workers reliably when the old binary and its process state remain available.

Build or obtain a compatible replacement

Use a replacement that matches the required operating-system libraries, compile-time options, dynamic modules, TLS support, and other dependencies of the running service. Compatibility is not limited to the version string: a binary can start successfully while a required module is absent or built for an incompatible ABI.

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Install the replacement in the path used by the service, but retain the rollback copy. If you use a symlink or an atomic file replacement, confirm which path the current master and the service manager actually execute; changing an unrelated copy has no effect on the running process.

Test the replacement against the live configuration

Run the configuration test with the replacement executable, using the same configuration file and include paths as the live service. The test must be performed by the new binary, not merely by the old command that happens to be first in your shell’s PATH.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
# Set these to the PID file and configuration used by this installation
PIDFILE=/run/nginx.pid
CONF=/etc/nginx/nginx.conf
NEW_NGINX=/usr/sbin/nginx

sudo "$NEW_NGINX" -t -c "$CONF"

Proceed only when the test reports a valid configuration and the expected modules can be loaded. A successful syntax test does not replace traffic testing, so treat it as a gate before the process handoff rather than as final proof.

Perform the no-drop binary handoff

1. Install the replacement and check the running master

Place the validated executable at the live service path. Confirm that the old master is still running and that the PID file contains the expected master PID. Save that PID before sending any signal.

PIDFILE=/run/nginx.pid
OLD_MASTER=$(cat "$PIDFILE")
printf 'Current master: %sn' "$OLD_MASTER"
ps -o pid,ppid,cmd -p "$OLD_MASTER"

Use the PID file configured for your installation; distributions and custom builds may use different locations.

2. Start the second generation with SIGUSR2

Send SIGUSR2 to the current master. NGINX renames the original PID file to an .oldbin form and launches a new master and workers from the replacement executable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo kill -USR2 "$OLD_MASTER"

Do not send SIGWINCH or SIGQUIT immediately afterward. The old generation must remain available while you prove that the new generation started correctly.

3. Verify the new master and workers

Check for the new master PID in the active PID file and the old master PID in the corresponding .oldbin file. Confirm that the new workers are children of the new master and that the executable and modules reported by the new process match the intended release.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Then test the service through the same path used by clients. Include representative virtual hosts, TLS listeners, authentication paths, static content, reverse-proxy routes, and any health endpoint that exercises upstream connectivity. Review error logs and upstream logs while sending normal test traffic. A process that exists but cannot serve a configured listener is not a successful upgrade.

  • The new master process exists and has the expected PID relationship.
  • New workers are running and remain running during observation.
  • Expected listening sockets are available to the new generation.
  • The replacement version and required modules are present.
  • Health checks pass through each important listener and route.
  • Representative requests complete without new NGINX or upstream errors.

Only after these checks pass should you begin draining the old generation.

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

4. Drain old workers with SIGWINCH

Read the old master PID from the .oldbin PID file and send it SIGWINCH. The old master tells its workers to shut down gracefully. They stop taking new work while existing requests and connections finish.

OLD_PIDFILE=/run/nginx.pid.oldbin
OLD_MASTER=$(cat "$OLD_PIDFILE")
sudo kill -WINCH "$OLD_MASTER"

Keep watching the old worker count and active connection metrics. Short requests may disappear quickly; long-lived requests, WebSockets, keepalive sessions, slow clients, and busy upstreams can keep workers alive considerably longer.

5. Retire the old master with SIGQUIT

When old workers have drained and the new generation continues to pass health checks, send SIGQUIT to the old master.

sudo kill -QUIT "$OLD_MASTER"

After the old master exits, confirm that only the new master and its workers remain. Check that the ordinary PID file now represents the active generation and that the .oldbin state is no longer needed. Keep the rollback executable until your operational acceptance period is complete, then remove it according to your change-control policy.

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

Why active connections can survive

The old and new masters overlap while they share the listening sockets. The new workers can accept new connections, while old workers continue handling requests that they already accepted. The graceful worker shutdown requested by SIGWINCH avoids an intentional close of those active requests.

Connection survival depends on reaching the signals in the correct order. If you stop the service first, kill workers forcibly, replace a binary that cannot load its modules, or retire the old master before the new workers are ready, the overlap protection is lost. A graceful upgrade also cannot prevent an application from closing a connection or a client from timing out independently.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Rollback when the new generation is bad

Rollback is easiest while the old executable, old master, and .oldbin PID file are still present. Stop treating the replacement as accepted as soon as health checks, logs, or real traffic show a regression.

Restore old workers

Send SIGHUP to the old master. In the documented binary-upgrade flow, this starts the old workers again without rereading the configuration. That distinction matters: the rollback is intended to restore the known-good generation rather than introduce an unverified configuration reload at the same time.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
OLD_PIDFILE=/run/nginx.pid.oldbin
OLD_MASTER=$(cat "$OLD_PIDFILE")
sudo kill -HUP "$OLD_MASTER"

Shut down the faulty new generation

Once old workers are serving again, gracefully shut down the new master. Identify the new master from the active PID file or process tree rather than guessing from worker PIDs. If the new master cannot be controlled normally, terminating it allows the old master to resume workers, but a forced termination should be treated as an emergency recovery action because it can interrupt work owned by the new generation.

After rollback, verify the old version, modules, listeners, health checks, and representative traffic. Do not delete the replacement immediately if you need logs or process evidence to diagnose the failure.

How long should the drain take?

There is no universal sleep interval for this procedure. Drain time is determined by request duration, WebSocket and other long-lived connections, keepalive behavior, worker load, client speed, upstream response time, and host scheduling.

Automation should wait for observable conditions instead of sleeping for an arbitrary number of seconds. Useful gates include:

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.
  • The new master PID is present and stable.
  • The expected new workers remain running.
  • Health checks and representative requests continue to pass for an observation window appropriate to your service.
  • Old worker processes have exited or the remaining connections are understood and intentionally allowed to continue.
  • Error rates, latency, upstream failures, and connection counts remain within your normal operating thresholds.

If old workers do not drain, inspect long-lived connections and active requests before taking action. Sending a forceful termination to meet a timer defeats the purpose of a graceful upgrade.

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

Manual binary replacement versus package-managed NGINX Plus

The signal choreography is the same conceptually, but the preparation and support model differ.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Decision axis Manual binary upgrade Package-managed NGINX Plus upgrade
Rollback control You retain the previous executable directly and control when it is replaced or restored. Use the package manager’s available versions and preserve the prior package and configuration according to the distribution runbook.
Repository and credentials Requires the binary source or build process you selected; no package repository is implied. Requires the official repository configuration and credentials for the installation.
Module and version compatibility You must validate compile-time options, dynamic modules, libraries, and the target configuration yourself. Check package contents and the release notes for source and target versions, including version-specific changes.
Backups At minimum, retain the old executable and PID state; preserve configuration and logs as part of your change procedure. Back up /etc/nginx and logs before using the operating system package manager.
Automation Expose each signal and verify each process transition explicitly. Combine package-manager transaction checks with the same PID, worker, health, and drain gates.
Operational support Your team owns the build, compatibility checks, and rollback artifacts. Follow the vendor’s distribution instructions and release notes in addition to the graceful handoff checks.

Do not assume that installing a package completes the no-drop procedure by itself. The package transaction changes files; the controlled overlap, verification, drain, and retirement still need to be observed.

Automating the runbook safely

A reliable automation job should be state-aware and abortable. Separate the workflow into stages so a failed check leaves the old generation available.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Capture state: record the current version, executable path, configuration path, master PID, worker list, listeners, and module expectations.
  2. Stage artifacts: copy the old executable, install the replacement, and retain configuration and log backups required by your deployment model.
  3. Validate: run nginx -t through the replacement executable and stop if it fails.
  4. Handoff: send SIGUSR2 to the recorded old master.
  5. Observe: wait for the new PID and workers, then run health and traffic checks. Abort and roll back if any gate fails.
  6. Drain: send SIGWINCH to the old master and wait for old workers to leave, allowing for known long-lived sessions.
  7. Retire: send SIGQUIT only after the new generation remains healthy and the drain condition is satisfied.
  8. Record: save final PIDs, version output, check results, and any warnings for the change record.

Make each wait interruptible and report the state that caused a timeout. A script that says only “sleep, then quit” can retire a healthy rollback path before the replacement has been observed.

Troubleshooting common failure modes

The new master never appears

Check the error log, executable permissions, linked libraries, module loading, configuration paths, and the PID-file location. Confirm that the binary you tested is the binary installed at the service path. Keep the old master running while correcting the problem; do not send the retirement signals.

The new master starts but workers exit

Inspect startup and error logs for module, privilege, resource, and upstream configuration errors. Re-run the replacement’s configuration test with the exact live include paths. Worker exit is a failed verification state even when the master PID exists.

Both generations appear healthy but old workers remain

Look for WebSockets, slow requests, keepalive sessions, large uploads, or blocked upstream responses. Measure active connections and request duration. Allow the known sessions to finish rather than converting the graceful drain into a forced kill.

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

Traffic fails after the handoff

Stop the retirement sequence, preserve the old PID and executable, and begin rollback. Compare listener bindings, loaded modules, TLS settings, proxy behavior, and error rates between generations. A syntax-pass does not prove behavioral compatibility.

The PID files are confusing

Use the process parent-child tree and the configured PID path to identify masters. The original master is associated with the .oldbin PID file during the overlap; the active PID file belongs to the new generation. Never send a signal to a worker merely because its command line contains NGINX.

Final preflight and completion checklist

  • Old executable copied and recoverable.
  • Configuration, logs, and package backups made where required.
  • Replacement modules and build options checked.
  • Replacement executable passed its own nginx -t against the live configuration.
  • Current master PID recorded before SIGUSR2.
  • New master and workers verified before draining.
  • Representative traffic and health checks passed.
  • SIGWINCH sent only to the old master from the .oldbin PID state.
  • Drain observed rather than assumed.
  • SIGQUIT sent only after the new generation was accepted.
  • Final process, version, listener, and error-log checks completed.
  • Rollback artifacts retained for the agreed acceptance period.

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
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.