October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober 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

Nginx Installed but Your Site Won’t Load: A Complete Troubleshooting Guide

Nginx running is only the first check. Follow a layer-by-layer workflow to verify listeners, server-block selection, static roots, upstream services, DNS, TLS, and the logs that identify the real failure.

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.

If Nginx is installed but your site will not load, work from the network edge inward: prove that the request reaches the correct IP and port, confirm which server block handles the Host header, then fix the static-file or reverse-proxy path. Run sudo nginx -t, inspect the actual listeners and expanded configuration, make one controlled curl request, and read the access and error logs before changing more settings.

What a running Nginx service does—and does not—prove

An active Nginx process only proves that a worker started successfully. It does not prove that Nginx is listening on the address your browser is using, that DNS points to this machine, that the intended configuration file was loaded, or that the request matches the right server block. A browser can therefore show the default welcome page, return a 404, report a 502, or fail before Nginx sees the request at all.

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.

Think of the request as passing through several boundaries:

  1. Client and DNS: the hostname must resolve to the expected public address.
  2. Listener: a firewall and Nginx must accept the destination IP and port.
  3. Server selection: the address, port, and HTTP Host header must select the intended server block.
  4. Content handler: a static root or rewrite must map the URI to content.
  5. Upstream: a reverse proxy must reach the backend protocol, hostname, and port.
  6. TLS: HTTPS must reach the correct SSL listener with readable certificate and key files.

Fix the earliest failed boundary. Changing application code will not repair a DNS or listener problem, and changing DNS will not repair a 502 caused by a stopped backend.

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

Start with evidence, not another reload

Validate the configuration and discover the paths

Before every reload, test the configuration that Nginx will actually parse:

sudo nginx -t

A successful test reports that the syntax is okay and the test is successful. If it names an include file, directive, permission problem, or line number, repair that exact file first. Do not keep reloading a configuration that has not passed this test.

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

Builds installed by packages, source compilation, containers, and control panels can use different files and log locations. Ask the binary where it was built to look:

nginx -V 2>&1

Inspect the output for --conf-path, --error-log-path, and, when you need debug logging, --with-debug. A common Linux error log is /var/log/nginx/error.log, but the compiled path and any per-server error_log directive take precedence. Use the same binary and privilege level that your service manager uses; otherwise you may test one installation while the service runs another.

Confirm the service and the real listening sockets

On a system using systemd, check the service state and recent startup messages:

sudo systemctl status nginx --no-pager
sudo journalctl -u nginx --since '-15 minutes' --no-pager

An active status can coexist with a listener bound only to loopback, only to IPv6, or to an unexpected port. Inspect sockets directly:

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

Compare every public request with an observed local address and port. For HTTP, that is usually port 80; for HTTPS, usually 443, but your configuration may use another port. If nothing is listening, resolve the service or configuration error before investigating server names. If Nginx listens on 127.0.0.1:80 while clients connect to a public address, it is not reachable on that public interface. If it listens only on an IPv6 address, an IPv4 DNS record can still fail.

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.

The Nginx web-server documentation describes listen as the directive that selects the IP address and port (or a Unix socket) for requests. Omitted values have context-dependent defaults, so write the intended address and port explicitly when diagnosing ambiguity.

Prove which configuration Nginx loaded

Expand includes with nginx -T

Distribution packages commonly include a main file plus files from an enabled-directory. A file sitting in an available directory is irrelevant until it is included. Print the complete parsed configuration:

sudo nginx -T

Search that output for every server { block, its listen lines, server_name, root, location, proxy_pass, and any default_server. Look for duplicate or conflicting blocks and for an include statement pointing to a different directory than the one you edited.

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

Understand address, port, and Host matching

Nginx first groups candidates by the local address and port selected by listen. It then compares the HTTP Host header to server_name. When no name matches, the request is handled by the default server for that address and port—explicitly marked with default_server, or otherwise the first matching server block.

A minimal static site block might look like this:

server {
listen 80;
server_name example.com www.example.com;
root /var/www/example;
index index.html;

location / {
try_files $uri $uri/ =404;
}
}

The welcome page means the request reached Nginx but selected a different block, or your intended block was never loaded. It is not evidence that the document root is correct.

Test selection locally with an explicit Host header

Bypass public DNS and test the server-selection decision directly:

curl -I -H 'Host: example.com' http://127.0.0.1/

Then test the machine’s public address while preserving the same Host header:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
curl -I -H 'Host: example.com' http://PUBLIC_IP/

Replace PUBLIC_IP with the address assigned to the server. A different status, response header, or body between these requests identifies a boundary outside the local server block—often a firewall, load balancer, NAT rule, or another endpoint answering the public address. Use curl -v when you need to see connection, redirect, and response details.

Separate static-file problems from reverse-proxy problems

Static sites: verify root, URI mapping, and permissions

For a static site, take the URI from the access log and map it to the configured root. With root /var/www/example, a request for /about.html normally looks for /var/www/example/about.html. Check the file and each parent directory:

sudo ls -l /var/www/example/about.html
namei -l /var/www/example/about.html

The Nginx worker must be able to traverse every parent directory and read the file. Correct ownership and mode for your distribution’s Nginx user, rather than a blanket writable mode, is the safer fix. Also inspect try_files, rewrites, trailing-slash redirects, and case-sensitive filenames. A single-page application often needs a deliberate fallback such as try_files $uri $uri/ /index.html;; a plain file server should generally return 404 for a missing path instead of hiding deployment errors with a fallback.

Reverse proxies: prove the upstream from the Nginx host

A proxy configuration adds another network hop:

server {
listen 80;
server_name app.example.com;

location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

Check that proxy_pass is inside the intended location, uses the correct protocol, resolves the hostname, and points to the port where the application is actually listening. Test the backend from the Nginx machine, not from your laptop:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -v http://127.0.0.1:3000/
sudo ss -ltnp | grep ':3000'

If the backend binds only to a private container or Unix socket, the address in proxy_pass must match that arrangement. A service can be healthy from inside a container while unreachable from the Nginx network namespace.

Use logs while making one controlled request

Logging is the fastest way to distinguish what Nginx received from what it could not complete. F5 NGINX documentation describes logging as essential for troubleshooting and understanding traffic flow.

In one terminal, follow the relevant files:

sudo tail -F /var/log/nginx/access.log /var/log/nginx/error.log

If those files do not exist, use the paths reported by nginx -V and the access_log or error_log directives in nginx -T. In another terminal, make exactly one request:

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
curl -v -H 'Host: example.com' http://127.0.0.1/

Match the timestamp, request method, Host, URI, status, and upstream message. The access log proves that a request reached a particular Nginx instance. The error log explains failures such as permission denial, missing files, upstream connection refusal, name-resolution errors, or SSL key problems. Repeat with the public hostname only after the local test is understood, so you do not mix several requests together.

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

Interpret the symptom before choosing a fix

Symptom Most likely boundary Checks and corrective action
Connection refused No process is accepting that address and port, or an active reject is in front of Nginx. Check ss -ltnp, the listen address, host firewall, cloud security group, load balancer, and NAT. If proxying, test the upstream separately.
Connection timeout Packets are being dropped or routed to the wrong endpoint. Verify DNS, public IP, firewall rules, security groups, and any reverse proxy or load balancer. A timeout usually occurs before Nginx can write an access-log entry.
Default Nginx welcome page or another site The request reached Nginx but selected the default or another server block. Compare listen, server_name, default_server, enabled includes, and the Host header in nginx -T.
404 Not Found The selected block cannot map the URI to content. Verify root, the exact case-sensitive filename, permissions, try_files, rewrites, and the URI recorded in the access log.
502 Bad Gateway Nginx reached the proxy stage but could not obtain a valid upstream response. Check the proxy_pass protocol, hostname, port, DNS resolution, backend process, bind address, and error-log message.
504 Gateway Timeout The upstream did not respond within the configured time. Test the backend directly, inspect application logs and network policy, and change timeout values only after proving the backend is reachable but slow.
HTTPS certificate or handshake failure The request reached the wrong TLS block, or certificate, key, protocol, or DNS does not match. Confirm listen 443 ssl, certificate and key paths and permissions, the requested hostname, and the endpoint returned by DNS. Use the exact browser or Nginx error rather than guessing.

Fix the common configuration failures

The intended server block is not enabled

Many Linux layouts separate available files from enabled files. Confirm that the main configuration includes the directory containing your site and that the site file is actually linked or included. After enabling it, run sudo nginx -t and reload. Do not delete the default block until your replacement answers correctly; keeping it as a known fallback makes selection mistakes visible.

The server_name does not match the real request

Include every hostname clients use, such as the apex name and its www form, or deliberately redirect one to the other. A typo, an unlisted alias, or a request made by IP address can send traffic to the default server. Test each name with an explicit Host header before relying on browser redirects.

The root is correct but access is denied

A 403 or an error-log permission message means the worker cannot traverse a directory or read the target. Check parent-directory execute permission, file read permission, ownership, and any mandatory access-control policy used by the operating system. Fix the narrowest permission that permits reads; do not make the whole web tree world-writable.

The proxy target is wrong or stopped

Read the exact upstream error. “Connection refused” usually means no process is listening at that address and port. “No such host” points to DNS or a misspelled upstream name. A response with an invalid header can indicate that the target is speaking a different protocol than the one in proxy_pass. Correct the backend or the proxy target, then test it locally before reloading.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

HTTPS-specific checks

HTTP and HTTPS can select different server blocks. Verify that DNS for the hostname reaches the expected endpoint and that the TLS request selects the block containing listen 443 ssl. Check that the certificate and private-key paths in the loaded configuration exist and are readable by the Nginx master process. A certificate for one hostname will not satisfy another hostname merely because both point to the same IP. If HTTP works but HTTPS fails, capture the exact browser message and correlate it with the Nginx error log; certificate mismatch, unreadable key, expired certificate, and handshake protocol errors require different fixes.

Escalate to debug logging only when normal logs are insufficient

Debug logging is noisy and should be temporary. First check whether the binary includes it:

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.
nginx -V 2>&1 | tr ' ' 'n' | grep -- '--with-debug'

If --with-debug is present, set an error_log directive to the debug level in the narrowest useful context, preferably the affected server block or location. For example:

server {
listen 80;
server_name example.com;
error_log /var/log/nginx/example-debug.log debug;
...
}

Run sudo nginx -t, reload, make one request, and remove or lower the debug directive afterward. Nginx’s debugging guidance warns that a more specific error_log without the debug level overrides a broader debug setting in that context, effectively disabling debugging there. Debugging helps expose request parsing, server selection, rewrite processing, and upstream connection details that normal error levels omit.

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

“Debugging helps to identify a bug in the program code if something goes wrong.” — F5 NGINX documentation, Debugging NGINX.

Reload safely and compare the result

A configuration change normally needs a reload, not a full restart:

sudo nginx -t && sudo systemctl reload nginx

The test prevents a bad file from being applied. A restart is reserved for cases where the service manager or a changed runtime dependency specifically requires it; restarting can create avoidable downtime and does not fix an incorrect server block.

Evaluate two possible fixes using four questions:

  • Where does the failure occur? Client/DNS, listener, server selection, static mapping, or upstream.
  • Is the change limited and reversible? Prefer a single server block or directive over a global change.
  • What operation is required? A validated reload is safer than a restart when the worker binary and service are healthy.
  • What evidence changed? Confirm the expected access-log status and the disappearance of the relevant error-log entry.

A compact end-to-end checklist

  1. Run sudo nginx -t and fix the exact reported file or line.
  2. Run nginx -V to identify the loaded configuration, error-log path, and debug support.
  3. Check service state and startup messages with systemctl or the equivalent service manager.
  4. Inspect ss -ltnp and compare listeners with every listen directive.
  5. Print sudo nginx -T; verify includes, server_name, default_server, root, locations, and proxy targets.
  6. Use curl -I -H 'Host: your-hostname' http://127.0.0.1/ to prove local server selection.
  7. For static content, verify root-to-file mapping and permissions.
  8. For a proxy, connect to the upstream directly from the Nginx host.
  9. Tail access and error logs while making one controlled request.
  10. Only after local behavior is correct, test DNS, firewalls, public routing, and HTTPS.
  11. Use temporary debug logging only if normal logs cannot explain the failure.

If the local Host-header test returns the intended site but the public hostname does not, stop editing Nginx and investigate DNS, firewall rules, security groups, NAT, a load balancer, or the managed hosting endpoint in front of it. If the local test returns the welcome page, 404, or 502, the evidence is already on the server: correct selection, content mapping, or upstream reachability before changing anything outside Nginx.

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

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

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.