Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →A 502 Bad Gateway from Nginx usually means it could not obtain a valid response from PHP-FPM. The fastest fix is to read the Nginx error-log line generated by one failing request, classify the errno, then verify that PHP-FPM is running, that its pool listen endpoint exactly matches Nginx’s fastcgi_pass, and that the Nginx worker can access the Unix socket. A passing nginx -t proves only that Nginx can parse its configuration; it does not prove that PHP-FPM is running or that the endpoint is reachable.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
What a 502 means in an Nginx/PHP-FPM stack
Nginx is the HTTP-facing server, while PHP-FPM is the FastCGI application server that executes PHP. For a PHP request, Nginx opens the endpoint named by fastcgi_pass, sends the request, and waits for a FastCGI response. A 502 appears when that handoff fails or the upstream closes the exchange before Nginx receives a valid response.
As an Amazon Associate I earn from qualifying purchases.
With a Unix socket, the endpoint is a filesystem path such as /run/php/php8.3-fpm.sock. With TCP, it is an address and port such as 127.0.0.1:9000. Socket filenames and service names vary by distribution and installed PHP version, so treat those examples as illustrations rather than universal defaults.
Start with the exact Nginx error-log line
Do not begin by changing timeouts or permissions at random. Nginx records connection failures in the configured error_log; the complete line normally identifies the upstream endpoint and the operating-system error. Watch the log while reproducing one failing PHP request:
#1 Best Overall
- 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.
sudo tail -n 100 /var/log/nginx/error.log
Your installation may use a different path, defined by its error_log directives. Capture the entire message, including the errno in parentheses. The wording distinguishes a missing socket from a stopped service, an access-control problem, a saturated pool, or an application that terminated early.
Missing Unix socket: “No such file or directory”
A message such as connect() to unix:/run/php/php-fpm.sock failed (2: No such file or directory) means the path named by Nginx did not exist when the request arrived. Check whether PHP-FPM is running and whether its pool creates a socket at that exact path. A versioned filename mismatch is common: Nginx may point to php-fpm.sock while the installed pool creates php8.3-fpm.sock.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsConnection refused
connect() failed (111: Connection refused) means the selected TCP port or Unix endpoint was not accepting connections. Inspect the FPM service, confirm the pool’s endpoint, and compare it with Nginx. A socket file left behind after a crash can exist while no process is listening, so existence alone is not proof of a healthy service.
Permission denied
connect() ... failed (13: Permission denied) means the socket is present but the Nginx worker cannot open it. Inspect the socket owner, group, mode, and every parent directory’s traversal permissions. Then compare those results with the pool’s listen.owner, listen.group, and listen.mode settings.
Upstream timeout
upstream timed out indicates that Nginx waited too long between reads from PHP-FPM. Investigate slow PHP work, an overloaded pool, and resource pressure before increasing a timeout. The fastcgi_read_timeout setting measures the interval between successive reads, not the total duration of a response.
Premature close or receive failure
upstream prematurely closed or recv() failed means the upstream closed or reset the connection before Nginx completed the response. Read the PHP-FPM pool log and system journal for startup failures, fatal errors, worker exits, or resource-limit messages, and correlate the event with the affected request.
Rank #2
- 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
| Nginx log pattern | What it establishes | First checks |
|---|---|---|
(2: No such file or directory) |
The configured Unix-socket path was absent at request time. | FPM service state, pool listen path, and the Nginx fastcgi_pass path. |
(111: Connection refused) |
The endpoint exists conceptually but is not accepting connections. | FPM process, selected TCP port or socket, and matching configuration. |
(13: Permission denied) |
The endpoint is present but inaccessible to the Nginx worker. | Socket owner, group, mode, directory traversal, and listen.* directives. |
upstream timed out |
Nginx stopped receiving data within the configured read interval. | PHP execution time, FPM queue, worker cap, CPU, and memory. |
upstream prematurely closed or recv() failed |
The upstream closed or reset the connection early. | PHP-FPM logs, application errors, worker exits, and system resource limits. |
Why nginx -t can pass while PHP still returns 502
nginx -t validates that Nginx can parse its configuration and, where applicable, prepare to start with it. It does not connect to PHP-FPM during the test. Nginx can therefore accept a syntactically valid fastcgi_pass pointing to a socket that has not been created, a port with no listener, or a socket the worker cannot access. The failure is discovered only when a request triggers the upstream connection.
Use the test after editing Nginx syntax, but pair it with an endpoint and service check:
sudo nginx -t
If the result is successful, reload Nginx after the endpoint and permissions are correct. A reload applies configuration without replacing the running service unnecessarily; it does not start a stopped PHP-FPM pool.
Verify PHP-FPM and make both endpoints identical
Find the installed FPM service
Distribution package names include the PHP version, so do not assume that an example such as php8.3-fpm is the unit on your host. List installed or active units, then use the matching name:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
systemctl list-unit-files | grep -i fpm
systemctl status php8.3-fpm
systemctl --failed
journalctl -u php8.3-fpm
Replace php8.3-fpm with the unit actually installed. The journal is especially useful when FPM fails during startup because of a bad pool directive, a missing directory, a port conflict, or a resource limit.
Read the active pool’s listen directive
Pool files are commonly under /etc/php/<version>/fpm/pool.d/. Open the pool serving the site and record its listen = ... value. PHP requires every pool to define an address at which it accepts FastCGI connections.
Rank #3
- 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)
grep -R "^[[:space:]]*listen[[:space:]]*=" /etc/php/<version>/fpm/pool.d/
Then inspect the Nginx server block and record fastcgi_pass. For a Unix socket, the values must identify exactly the same path, including spelling, directory, and PHP-version suffix:
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
For TCP, both sides must use the same address and port. Do not change only Nginx or only FPM; an endpoint mismatch leaves the two services unable to communicate.
Free tools Windows power users keep installed
One-click scans. No signup required.
Apply a corrected endpoint
- Edit the FPM pool or Nginx server block so the two endpoint values match.
- Validate Nginx syntax with
sudo nginx -t. - Reload Nginx:
sudo systemctl reload nginx. - Restart or reload the matching FPM unit so it creates or binds the corrected endpoint.
- Reproduce one PHP request while watching the error log.
If the socket disappears again after an FPM restart, inspect the FPM journal and the pool’s directory and runtime-path configuration instead of manually creating a placeholder socket. The FPM process must create and own the listening endpoint.
Fix Unix-socket permissions without creating a security hole
Set the pool’s socket ownership and mode
On Linux, PHP-FPM controls Unix-socket access with listen.owner, listen.group, and listen.mode. Set the owner and group so the Nginx worker account can connect, and use a restrictive mode such as the distribution’s documented 0660-style default. The exact account names differ by distribution.
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
Those values are examples of the relationship to establish, not a universal prescription. If Nginx and FPM use different accounts, place both in a dedicated shared group or use an ACL granting only the required access. Avoid making the socket world-writable as a shortcut.
Check the directory path, not only the socket
Even with a correct socket mode, the Nginx worker must be able to search every parent directory. Inspect the path and the resulting socket after restarting FPM:
Rank #4
- 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
ls -l /run/php/php8.3-fpm.sock
stat /run/php/php8.3-fpm.sock
Confirm the displayed owner, group, and mode, then verify directory permissions for /run and /run/php (or the equivalent path on your system). Recreate the socket by restarting or reloading FPM; changing a pool directive does not retroactively alter an existing socket.
Retest as the service actually runs
Make one request through Nginx while tailing its error log. If the error changes from permission denied to a successful response, the access-control issue is resolved. If it remains, check whether the worker account differs from the account you assumed and whether a mandatory-access-control policy is also denying traversal; the Nginx error line and system security logs will show the next boundary to investigate.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Diagnose queue saturation, worker limits, and timeouts
Read FPM status counters
When failures occur only under load, expose the PHP-FPM status path to administrators and review listen queue, max listen queue, active processes, idle processes, and max children reached. These counters show whether requests are waiting for a worker rather than failing because of a path or permission error. Keep the status endpoint private; it reveals operational details.
Understand pm.max_children
pm.max_children is the hard cap on simultaneous FPM workers. A nonzero max children reached together with a growing listen queue indicates that all workers are busy. Raising the value without measuring memory and CPU per worker can exhaust RAM, trigger swapping, and create more failures. Measure the application’s worker footprint and available memory first, then change the cap deliberately.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11The pool’s process manager can be dynamic, ondemand, or static. These modes change how workers are created and retained, but none removes the concurrency limit imposed by pm.max_children. Tune the mode and worker count together with observed queue depth and latency.
Use fastcgi_read_timeout carefully
The Nginx module documentation gives a 60-second default for fastcgi_read_timeout. That value is a configuration default, not a performance guarantee. Because the timer applies between successive reads, a script that periodically sends data can behave differently from one that remains silent for the same total duration. Increase the setting only after confirming that the application legitimately needs more time and that the FPM pool has enough capacity.
Best Value
- 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.
Increase logging only as far as needed
Raise the applicable error_log level
Nginx writes messages at the closest applicable error_log level. Set a more detailed level for the affected server or location when the normal log does not explain the failure, reproduce a single request, and collect the relevant lines. Keep the scope and duration limited so routine logs do not become noisy.
Use debug logging temporarily
Nginx debug logging requires a binary built with debug support and the debug parameter on error_log. If those prerequisites are met, enable it briefly, reproduce one failure, save the evidence, and return to the normal level. Debug output is a diagnostic aid, not a permanent production setting.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Read the PHP-FPM side
Check the pool log and journalctl output for worker crashes, fatal PHP errors, startup failures, and operating-system resource messages. A valid Nginx configuration cannot compensate for an FPM service that repeatedly exits or refuses to start. Fix the underlying FPM error before changing Nginx directives.
Choose Unix sockets or TCP deliberately
For Nginx and PHP-FPM on the same host, a Unix socket is usually the natural boundary: access is controlled by filesystem ownership, group, mode, and directory permissions. TCP can be useful when the processes are separated by a container or host, but it introduces a network listener that must be bound and restricted carefully.
| Decision axis | Unix socket | TCP endpoint |
|---|---|---|
| Locality | Best suited to Nginx and FPM sharing a filesystem on one host. | Useful when Nginx and FPM are separated by a host or container boundary. |
| Access control | Filesystem owner, group, mode, directory traversal, and optional ACLs. | Bind to a private interface and restrict which clients may connect. |
| Typical failure evidence | Missing path, refused connection, or permission-denied errno in the Nginx log. | Refused connection, incorrect address or port, firewall or listener configuration. |
| Failure isolation | Depends on the local runtime directory and both services’ lifecycles. | Separates the transport path, but adds network configuration and exposure to secure. |
Whichever transport you choose, keep the endpoint private. PHP warns that an untrusted FastCGI client can control request configuration, including auto_prepend_file, and can use that control to execute arbitrary code. PHP-FPM must not be reachable from an untrusted network. For TCP, bind to a private interface and use the pool’s client restrictions where available.
A complete recovery sequence
Use this order when you need a repeatable response rather than a collection of guesses:
Quick Recap
- Reproduce one failing PHP request and capture the full Nginx error-log line.
- Classify it as missing endpoint, refusal, permission denial, timeout, or premature upstream close.
- Confirm the installed FPM unit is running and read its journal for startup or worker errors.
- Read the active pool’s
listenvalue and compare it character-for-character with Nginx’sfastcgi_pass. - For a Unix socket, inspect owner, group, mode, and parent-directory traversal; correct
listen.owner,listen.group, orlisten.modeas needed. - Restart or reload FPM so the corrected socket is recreated, then validate Nginx with
sudo nginx -tand reload Nginx. - If the error appears only under load, inspect FPM status counters before changing
pm.max_childrenor a timeout. - Use targeted higher-level logging or temporary debug logging only when normal logs and service status do not identify the cause.
- Retest through the real Nginx virtual host and keep the endpoint restricted to trusted local or private clients.
Prevent the next socket outage
- Keep the PHP version in the pool filename and the Nginx
fastcgi_passpath synchronized whenever PHP is upgraded. - After package changes, verify that the expected FPM unit starts and that its runtime directory and socket are recreated.
- Monitor FPM queue counters and
max children reached, not only HTTP status codes. - Record the Nginx worker account and FPM pool ownership settings so permission changes are intentional.
- Keep the FPM status path and any TCP listener restricted to administrators or private interfaces.
- Leave Nginx debug logging disabled after collecting the evidence needed for a specific incident.
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.




