Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
VGSOURCES
Get listed

502 Bad GatewayPATCH 2026.10.15

How to Fix a GitLab 502 Bad Gateway on a Self-Hosted VPS

By VGSources Team 9 min read

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

A GitLab 502 on a VPS usually means the front-end proxy cannot obtain a usable response from GitLab’s application upstream. If the server was just rebooted or GitLab was restarted, wait up to about one minute on a single-core machine: GitLab documents that the instance returns 502 until Puma is ready. If the error persists, check the managed service states, restart the narrowest failed component, and then trace the NGINX → Workhorse → Puma path. A registry-only 502 follows a different troubleshooting branch.

What a GitLab 502 means on a VPS

HTTP 502 Bad Gateway is a proxy-level response. In a standard Linux-package GitLab installation, the request normally travels through NGINX, GitLab Workhorse, and Puma, which runs the Rails application. A failure at any hand-off can look identical in the browser even though the underlying cause differs.

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.
Layer Role in the request What a failure can look like
NGINX Accepts the client connection and proxies GitLab traffic. Immediate 502, connection or upstream errors, or an unavailable web endpoint.
GitLab Workhorse GitLab’s smart reverse proxy for resource-intensive and long-running requests; it handles HTTP traffic to and from Rails. Requests fail even when NGINX itself is running, because Workhorse cannot reach or serve the Rails upstream.
Puma Runs the GitLab Rails application. Workhorse has no healthy application process to contact, producing an upstream refusal or timeout.
Sidekiq Processes background jobs alongside the web application. It can be down during startup or a wider service incident; web availability may return only after the full stack settles.
PostgreSQL and Redis Provide database and cache/queue services used by GitLab. Application processes may fail to initialize or remain unhealthy when dependencies are unavailable.

The 502 page does not identify which layer failed. Use service status and the affected feature to narrow the problem before changing configuration.

First, determine whether the outage is still starting up

Check what is affected

Open the main GitLab web interface and test the specific operation that reported the error. Record whether the failure affects:

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses | Anti UV Ray, For Computers & Gaming, Square Frame, Eyewear for Men and Women
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
  • the entire web UI;
  • Git over HTTP;
  • API requests; or
  • only container-registry requests.

This distinction matters because the main application and the registry can use different upstreams and configuration. A working GitLab UI with a failing registry should not trigger an indiscriminate restart of every service.

Allow the documented restart interval

After a VPS reboot or a GitLab restart, do not immediately rewrite proxy settings. GitLab states that the instance gives a 502 until Puma is up again, and that a single-core server may take up to a minute for Puma and Sidekiq to restart. Treat a short-lived 502 during that interval as expected startup behavior. If the page remains unavailable after the interval, continue with service checks.

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

Check the Linux-package service state

These commands apply to a GitLab installation managed by the Linux package. Log in with an account that can use sudo, then run:

sudo gitlab-ctl status

The output reports the state of managed components, including NGINX, Puma, Workhorse, Sidekiq, PostgreSQL, and Redis. Look for a service marked down, repeatedly restarting, or failing to become ready. A single unhealthy process can explain a 502 while the other services appear normal.

Compare the status output with the scope you observed:

  • If NGINX is down, the client may receive a connection failure or an immediate gateway error before the request reaches Workhorse.
  • If Workhorse is down, NGINX may be listening but have no healthy proxy target.
  • If Puma is down or still starting, Workhorse cannot complete Rails requests.
  • If a dependency such as PostgreSQL or Redis is unhealthy, Puma or Sidekiq may fail to initialize correctly.

Status is a point-in-time check. Run it again after any restart and wait for processes to report healthy before testing the site repeatedly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Restart the smallest failing scope first

A targeted restart limits disruption and makes the result easier to interpret. Restart the component that status identifies rather than immediately cycling the entire stack.

Restart NGINX only

Use this when NGINX is the component that is stopped or wedged:

sudo gitlab-ctl restart nginx

After the command completes, check status again:

sudo gitlab-ctl status

Then retry the same URL that produced the 502. If NGINX returns to a healthy state and the error disappears, avoid restarting Puma or the database unnecessarily.

Restart the complete GitLab service set

When several managed services are unhealthy, or when a coordinated restart is appropriate after maintenance, use:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo gitlab-ctl restart

Expect a temporary outage while Puma, Sidekiq, Workhorse, NGINX, and their dependencies come back. On a single-core VPS, the documented startup window can be as long as one minute. Run sudo gitlab-ctl status after that window and verify that the web path is available before declaring recovery.

Use kill only as a last resort

GitLab’s maintenance guidance notes that a stuck component may require gitlab-ctl kill <service> before it can be restarted. This forcibly terminates the named service and can interrupt requests or background work. Use it only when you understand which service is stuck and what work may be lost; follow it with a targeted restart and a fresh status check.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Trace the NGINX–Workhorse–Puma path

If every service appears up but clients still receive 502, investigate the hand-offs in request order. NGINX should be able to reach Workhorse, and Workhorse should be able to reach Puma/Rails. GitLab describes Workhorse as a smart reverse proxy intended for resource-intensive and long-running requests; it intercepts every HTTP request destined for or emitted from GitLab Rails.

When NGINX is healthy but the application is not

An active NGINX process only proves that the front door is listening. A 502 can remain if Workhorse’s upstream is refusing connections or if Puma has not finished starting. Correlate the states of all three services and inspect their time-correlated logs using the logging method appropriate to your installation. Look for an upstream connection refusal, timeout, or a process repeatedly exiting rather than treating the HTML error page as the diagnosis.

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

When Puma is repeatedly restarting

Allow the documented startup interval once, then check status again. If Puma never reaches a stable state, the gateway error is a symptom of that application failure, not an NGINX routing problem. Keep the restart scope narrow while you determine whether a dependency or host resource issue is preventing Puma from staying up.

When only long or large requests fail

Because Workhorse handles resource-intensive and long-running Rails requests, a failure limited to those operations still belongs in the Workhorse/Puma branch. Compare a simple page request with the failing operation and correlate the proxy and application states at the same time; do not assume that a successful login proves every upstream path is healthy.

External reverse proxy: permissions, sockets, and trusted proxies

The troubleshooting changes when bundled NGINX is disabled and an external NGINX or Apache instance fronts GitLab. Configuration ownership is then split: the external web server accepts traffic, while GitLab’s generated configuration still defines Workhorse and application endpoints.

Topology What you must verify Who owns the change
Bundled GitLab NGINX Managed service status and the internal NGINX → Workhorse path. GitLab’s package-managed services and gitlab.rb settings.
External NGINX External process permissions, the Workhorse socket or TCP target, and trusted-proxy settings. Your external web-server configuration plus GitLab’s generated configuration.
External Apache All of the above, with a Workhorse TCP listener when Apache cannot connect to a UNIX socket. Apache configuration and GitLab’s Workhorse settings.

Give the external web server the required access

GitLab requires the external web-server user to be configured and to have access through the gitlab-www group. If the proxy reports a permission error while reading the upstream socket or related files, verify the user and group membership before changing application settings. A proxy that cannot read or connect to its upstream will surface a gateway error regardless of Puma’s state.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Match the upstream transport

NGINX can proxy to the Workhorse UNIX socket normally used by the package. Apache cannot connect to that UNIX socket in the documented setup, so configure a Workhorse TCP listener and point Apache at the matching TCP address. A socket-versus-TCP mismatch produces a persistent 502 even when Workhorse itself is running.

Apply GitLab configuration changes

After editing /etc/gitlab/gitlab.rb for the external proxy, trusted proxies, or Workhorse listener, apply the generated configuration:

sudo gitlab-ctl reconfigure

Retest the same endpoint after reconfiguration. Keep one known-good upstream target and change one setting at a time so that a new failure can be attributed to the edit.

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

Check trusted-proxy behavior

Trusted-proxy settings control how GitLab interprets requests forwarded by the external web server. An incorrect trust configuration can break requests or produce misleading client information even when the upstream connection works. Confirm that the external proxy’s address and forwarding arrangement match the GitLab settings generated from gitlab.rb.

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

When only the container registry returns 502

A registry-only failure is a separate branch. If the main GitLab UI, Git over HTTP, and API work but image pulls or pushes fail, inspect the registry NGINX configuration and the registry upstream instead of restarting the entire Rails stack.

Check localhost address-family resolution

GitLab documents a failure in which localhost resolves to IPv6 ::1 while the registry is listening on IPv4. In that situation, force the registry listener to IPv4 in /etc/gitlab/gitlab.rb:

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
registry['registry_http_addr'] = "127.0.0.1:5000"

Apply the setting with:

sudo gitlab-ctl reconfigure

Then test a registry request again. This change addresses the documented IPv6-to-IPv4 localhost mismatch; it is not a universal fix for every registry 502.

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

Consider the documented GCS and HTTP/2 case

GitLab also documents a registry deployment failure involving pushes to Google Cloud Storage and HTTP/2. For that specific scenario, the documented workaround is to disable the HTTP/2 client in the registry process with:

GODEBUG=http2client=0

Use this only when your registry deployment matches that GCS push failure. It does not explain a general web-UI 502 and should not be applied solely because the registry endpoint is unavailable.

Account for VPS resource pressure without guessing at the cause

There is no universal percentage or guaranteed repair time for GitLab 502 errors. The cause depends on installation type, reverse-proxy topology, the failing service, and conditions such as host resource pressure. A small VPS may take longer to bring Puma and Sidekiq back after a restart, especially on a single core, but a longer delay alone does not identify the failing component.

Use evidence from the sequence of events:

  • A 502 that appears immediately after reboot and clears within the documented startup interval is consistent with normal Puma startup.
  • A 502 that remains while one service is down points to that service’s recovery path.
  • A 502 limited to one feature points to that feature’s upstream, such as the registry.
  • A 502 introduced after moving to an external proxy points first to permissions, socket/TCP targeting, or trusted-proxy configuration.

Avoid claiming that a restart has permanently fixed the problem unless the service remains healthy and the affected request succeeds after the restart. If a component repeatedly fails, preserve the status and log evidence before making broader changes.

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.

A decision workflow you can repeat

  1. Classify the failure. Test the web UI, Git over HTTP, API, and registry separately so you know whether the issue is global or feature-specific.
  2. Check timing. If the host or GitLab was just restarted, allow up to the documented one-minute single-core startup interval before editing configuration.
  3. Inspect managed state. Run sudo gitlab-ctl status and identify services that are down, restarting, or timing out.
  4. Restart narrowly. Use sudo gitlab-ctl restart nginx for an NGINX-specific failure; use sudo gitlab-ctl restart only when a broader restart is justified.
  5. Recheck and retest. Run status again, wait for services to settle, and repeat the exact request that failed.
  6. Trace the path. If status is healthy but 502 persists, correlate NGINX, Workhorse, and Puma connectivity and logs.
  7. Validate external-proxy settings. Confirm the web-server user, gitlab-www access, Workhorse socket or TCP target, and trusted-proxy configuration; run sudo gitlab-ctl reconfigure after edits.
  8. Use the registry branch when appropriate. Inspect registry upstreams, apply the documented IPv4 listener setting for the localhost/::1 mismatch, or use the GCS-specific HTTP/2 workaround only when that scenario matches.

What not to assume

  • There is no single fix that applies to every GitLab 502 on every VPS.
  • A running NGINX process does not prove that Workhorse or Puma is reachable.
  • A registry-only 502 does not prove that the Rails application is down.
  • A restart that restores service once does not establish a permanent cause.
  • GitLab does not publish a universal percentage breakdown of 502 causes or a guaranteed recovery time.

The reliable approach is to identify the failing scope, verify the managed state, restart the smallest affected component, and then follow the actual proxy path. That sequence minimizes downtime while keeping the diagnosis tied to observable evidence.

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.

502 Bad Gatewaycontainer registryGitLabGitLab WorkhorseNGINXPumaself-hosted VPSserver troubleshooting

Leave a reply

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

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.

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
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.