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.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A Dokku 502 Bad Gateway usually means nginx cannot reach a healthy web process for your app. Start with process health and the app’s nginx error log, then verify the host-to-container port mapping, the listener’s bind address, nginx configuration, and Ubuntu firewall rules. Do not begin by tuning nginx: Dokku intentionally serves 502 when an app has not been deployed, has no web process type, or has no running web processes.

Replace APP in the commands below with the Dokku app name. The exact final fix depends on your framework, Dockerfile or buildpack, Dokku release, internal listen port, and the error-log message.

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

What a 502 means in Dokku

Dokku places nginx in front of each application. Nginx accepts the browser request and proxies it to the web process inside the app container. A 502 is therefore a failure between nginx and that upstream process, not proof that the deployment command itself failed.

Dokku documents an intentional 502 configuration for three states: an app exists but has not been deployed, the app has no web process type, or it has no running web processes. In those cases nginx generates a minimal configuration that returns 502 Bad Gateway. Starting or repairing the web process is required; reloading nginx alone cannot create one.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

The five layers to check

Layer Healthy condition Typical evidence Corrective action
Application deployment The app has a successful release and a formed web process. dokku ps:report APP and deployment logs Redeploy or correct the Procfile/process formation.
Process runtime The web process stays running instead of exiting. dokku logs APP --tail Fix the start command, environment variables, migrations, or crash shown in the log.
Port routing Nginx’s mapped internal port matches the port the server listens on. dokku ports:report APP Set the correct mapping with dokku ports:set.
Container listener The server listens on the container interface at the mapped port. Application startup output and container inspection Bind to 0.0.0.0, not only 127.0.0.1, and use the intended port.
Nginx and host networking Generated configuration is valid and traffic is not blocked. Nginx error log, config validation, UFW or other firewall rules Repair stale configuration, reload after validation, and allow the Docker/Dokku path.

1. Confirm the app and web process are healthy

Run the process report and tail the application log before changing configuration:

dokku ps:report APP
dokku logs APP --tail

A healthy deployment must show a running web process. If no web process exists, inspect how the app is formed. A Procfile or equivalent process definition must declare the command that serves HTTP. Correct that definition and redeploy rather than trying to repair nginx.

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

If the process repeatedly exits

Read the last startup and crash messages in dokku logs APP --tail. Common causes include an incorrect start command, a required environment variable that is missing, a migration or initialization step that fails, and a server that cannot bind to its configured address or port. Fix the cause shown by the application, then redeploy or start the corrected release. A restart is useful only after the underlying process problem is fixed; it cannot supply a missing process type or repair a bad port map.

If the app was never deployed

Dokku’s deliberate minimal nginx configuration returns 502 until a release with a web process is deployed. Complete a normal deployment and verify the process report again. Do not edit the generated nginx file to bypass this state.

2. Read nginx’s per-app evidence while reproducing the error

Open the app-specific logs and configuration:

dokku nginx:error-logs APP -t
dokku nginx:access-logs APP
dokku nginx:show-config APP

The default files are /var/log/nginx/APP-error.log and /var/log/nginx/APP-access.log. Keep the error log following while you make one request in another terminal or browser. The newest line usually identifies which layer failed.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Connection refused

A refusal generally means nginx reached the container address but nothing is accepting connections on the mapped port. Return to dokku ps:report APP and the application log. Check that the process is still running, that the server started successfully, and that it listens on the same port reported by Dokku.

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

Upstream timeout

A timeout indicates that the upstream did not answer in time. Investigate a wedged or overloaded process, a startup operation that never completes, or an application endpoint that blocks. The nginx log tells you that the proxy waited; the application log and runtime state identify why.

Upstream address or port mismatch

If the error refers to an unreachable upstream address or port, compare the generated configuration with the port report and the application’s actual listen setting. Correct the mapping before reloading nginx.

3. Verify and correct Dokku’s port mapping

Ask Dokku what external-to-internal mapping it is using:

dokku ports:report APP

Compare the reported internal port with the port used by the web server in the container. For example, if the application genuinely listens on port 5000, the documented form of a correction is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
dokku ports:set APP http:80:5000

Do not copy 5000 unless your application actually uses it. Replace it with the real internal port. The left side, http:80, represents the public HTTP side; the final value is the container port nginx must reach.

How to determine the real internal port

  • Read the framework start command and its explicit port option.
  • Check startup output in dokku logs APP --tail; many servers print the bound address and port.
  • Inspect the Dockerfile’s EXPOSE declaration. Dokku documents that exposed ports can influence proxy configuration, but EXPOSE is not proof that a process is listening.
  • Confirm the runtime setting used by the image or buildpack rather than relying on a local-development default.

A correct mapping with no listener still produces 502, so always pair ports:report with process and listener checks.

4. Make sure the container listener is reachable

The web server must bind to 0.0.0.0:<port> inside the container. Binding only to 127.0.0.1 makes the service reachable from its own process namespace but not through Docker networking, so nginx receives a refusal or timeout even when the process appears “up.”

Typical binding corrections

  • Set the framework’s host or bind option to 0.0.0.0.
  • Set the application port to the same value used by dokku ports:report APP.
  • Ensure the process command does not start a development server that binds only to localhost.
  • After changing the image, Procfile, or environment, redeploy and check the new process state.

Dockerfile EXPOSE values and Dokku port settings both affect what nginx is configured to proxy, but neither one starts a web server. The listening process remains the source of truth.

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

5. Validate nginx before reloading

Once process and port issues are corrected, validate the configuration before activating it:

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
sudo nginx -t
dokku nginx:validate-config APP
dokku nginx:reload

Use the commands supported by your Dokku release. A successful validation should report a syntactically valid configuration. If validation fails, do not reload. Read the error, inspect the generated app configuration, and correct the source of the bad directive or mapping.

When generated configuration is stale

Display the current generated file with:

dokku nginx:show-config APP

Compare its upstream address and port with dokku ports:report APP and the application’s actual listener. If the file is out of date, rebuild the proxy configuration using the configuration-build command documented for your installed Dokku release, then run validation again. The exact rebuild command can vary by Dokku version, so do not substitute an arbitrary nginx command.

Why validation and reload are separate

dokku nginx:validate-config APP or sudo nginx -t checks the proposed configuration without activating it. dokku nginx:reload applies a valid configuration to running nginx. Keeping these operations separate prevents a syntax error or incomplete generated file from taking down otherwise healthy applications.

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

6. Check Ubuntu firewall rules and the host path

Dokku’s troubleshooting documentation identifies a firewall such as UFW as a possible cause of Bad Gateway on Ubuntu. This is especially relevant when deployment reports success, the web process is running, and the mapping appears correct.

What to inspect

  • Review UFW status and rules on the Ubuntu host.
  • Confirm that public HTTP and HTTPS traffic can reach nginx.
  • Check that host firewall policy does not block the Docker or Dokku forwarding path.
  • Reproduce the request while following dokku nginx:error-logs APP -t; a new log line helps distinguish a firewall path from an application refusal.

Do not broadly disable the firewall as a first step. Add the narrow rules required by your host policy, then test again. Firewall behavior can differ with Ubuntu version, Docker networking mode, and existing administrator rules.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

7. Re-test from the outside and isolate the repaired layer

After each targeted change, make a fresh request:

curl -I http://APP.example.com

Use the hostname that resolves to this Dokku host. Interpret the result together with the logs:

  • If the status changes after the web process is repaired, process availability was the failing layer.
  • If it changes after dokku ports:set, nginx had been sending traffic to the wrong internal port.
  • If nginx validation fails, the generated configuration or its source settings still need repair.
  • If the map is correct but the log still shows refusal, check the bind address, process crash output, and current runtime state.
  • If the app works locally but external requests fail and the error log remains quiet, verify DNS, the public listener, and host firewall policy before changing application code.

Keep the error log open during the test so you correlate one request with one upstream event instead of guessing from an old 502 response.

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

Common 502 scenarios and the right remedy

Observed situation Most likely layer First check Remedy that persists
New app immediately shows 502 Deployment or process formation dokku ps:report APP Deploy a release with a declared, running web process.
Deploy succeeds, then 502 appears Runtime crash or missing environment dokku logs APP --tail Fix the startup failure and redeploy.
Error log says connection refused No listener or wrong port dokku ports:report APP plus app logs Start the server, bind it to 0.0.0.0, or correct the mapping.
Error log says upstream timeout Hung or slow upstream Application logs and process state Resolve the blocking startup or request path; do not mask it with a blind reload.
Generated config points to an old port Stale nginx configuration dokku nginx:show-config APP Regenerate with the command for your Dokku release, validate, then reload.
Process and map are correct but external requests fail Host firewall or forwarding UFW rules and live nginx log Allow the required HTTP/HTTPS and Docker/Dokku path under your security policy.

What not to do

  • Do not reload repeatedly. Reloading cannot create a missing web process, change a wrong port, or fix a crash loop.
  • Do not edit generated nginx files as a permanent fix. Dokku can regenerate them during deployment or configuration changes.
  • Do not assume EXPOSE proves availability. It describes intended container networking; the process must still listen.
  • Do not force port 5000. That value is only an example; use the port your image actually serves.
  • Do not treat a successful deploy message as an end-to-end test. Verify a running process, a reachable listener, a valid proxy configuration, and an external request.

Preventing the next Dokku 502

Before deploying a change, keep the web process definition, bind address, and internal port consistent. Record the intended port in the image or application configuration and make the Dokku mapping match it. After deployment, check dokku ps:report APP, watch dokku logs APP --tail during startup, and make one real HTTP request.

When changing ports, update the application and Dokku mapping as one change, then inspect dokku nginx:show-config APP and validate before reloading. When changing firewall rules, test both public HTTP and HTTPS paths. These checks catch the five failure layers before users encounter a generic 502 page.

A compact recovery sequence

  1. Identify the app and run dokku ps:report APP.
  2. Follow dokku logs APP --tail and repair any crash, missing variable, migration failure, or bad start command.
  3. Confirm a running web process; redeploy if the process definition is missing.
  4. Read dokku nginx:error-logs APP -t while reproducing the request.
  5. Run dokku ports:report APP and compare the internal port with the actual listener.
  6. Correct a mismatch with dokku ports:set APP http:80:INTERNAL_PORT, substituting the real port.
  7. Ensure the server binds to 0.0.0.0 and that any EXPOSE value names the intended web port.
  8. Inspect dokku nginx:show-config APP; rebuild stale generated configuration using your Dokku release’s documented command.
  9. Run sudo nginx -t or dokku nginx:validate-config APP.
  10. Only after validation succeeds, run dokku nginx:reload, check UFW and forwarding rules, and verify with curl -I http://APP.example.com.

The Bottom Line

Fix the layer that the evidence identifies: restore a running web process, map nginx to the port it really serves, bind that server to 0.0.0.0, validate and reload generated nginx configuration, then check Ubuntu firewall rules. A Dokku 502 is usually a precise upstream-health or routing signal, not a reason to restart blindly.

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.

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