Pcornel
Browse topics
Options
Recent
Favorites
Web Infrastructure · Technical reference

Nginx

Direct answer

Nginx is an event-driven web server and reverse proxy, configured with server blocks (virtual hosts) and location blocks, commonly in /etc/nginx/nginx.conf, conf.d/ and sites-enabled/.

When to use this

Use it to configure or troubleshoot Nginx sites and proxies.

First 30 seconds

1. nginx -t — syntax ok?

2. nginx -T | grep -n server_name — which block handles the name?

3. Error log for upstream errors.

4. Upstream up? curl -v http://127.0.0.1:<port>.

5. systemctl reload nginx and test.

Operational verification

request → listen socket → server_name match → location → static file or proxy_pass → response

Evidence · next step

For Web Services → Nginx, continue with the first unproven Topic check: Pin effective config, listener, requested scheme/Host/path and expected upstream or document root. If that boundary is healthy, advance to the adjacent check: Validate and inspect the parsed configuration, process state and socket ownership. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Scope / prerequisiteUse it to configure or troubleshoot Nginx sites and proxies.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

7 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

nginx config/includes → syntax/effective dump → master/workers → listen socket → server_name/SNI → location selection → file/proxy/upstream → response/log

Healthy evidence: effective config parses, master/workers run, intended listener and server_name/location are selected, upstream/static handling succeeds and logs match the client response

Step 2 Verification and output interpretation Verify boundary

Existing fast checks for this Topic. - Pin effective config, listener, requested scheme/Host/path and expected upstream or document root.

  • Validate and inspect the parsed configuration, process state and socket ownership.
  • Send the exact request while correlating access/error logs and upstream status or filesystem access.
  • Make the smallest persistent change, reload, and repeat the original request plus one neighboring route.

Verification chain. nginx config/includes → syntax/effective dump → master/workers → listen socket → server_name/SNI → location selection → file/proxy/upstream → response/log

Step 3 Specialized verification Verify boundary

Validate syntax, inspect the effective expanded configuration when include ambiguity matters, then verify master/worker generations after reload. Test the exact listen address, hostname/SNI and request path, capturing status, headers and logs. If the response is wrong, localize server selection before location/upstream behavior. A successful config test shows parsing; a successful reload shows Nginx accepted it; only the client request shows the intended virtual host/path behavior.

Step 4 Commands Verify boundary
nginx -t
nginx -T | head
tail /var/log/nginx/error.log
Step 5 Failure modes and next checks Narrow the fault

Suspicious evidence: syntax passes but another server block/location wins, old config remains loaded, upstream resolution/connectivity fails, permissions block static content, or client path differs from local testing

Step 6 Special cases and limits Narrow the fault

Nginx can be healthy while the upstream application is down, and an HTTP error may be generated by Nginx, an upstream or another proxy. A 200 response on localhost/default Host does not show the public virtual host. TLS certificate selection can differ by SNI. Reload success does not show every request uses only new workers instantly. Keep listener/virtual-host selection, request routing, upstream and application result separate.

Step 7 Common mistakes Narrow the fault
  • Missing server_name, so the default server answers.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points

nginx -t before every reload. nginx -T prints the full merged config. The first matching server block for a port is the default — unknown names land there. 502 means the upstream refused or crashed; 504 means it timed out.

Key checks
  • systemctl status nginx|apache2|httpd — web server state
  • nginx -t / apachectl configtest — configuration test
  • ss -ltnp | grep -E ':80|:443' — listening ports
  • curl -vI https://<name> — response, headers and TLS
  • tail -f /var/log/nginx/error.log — error log (or apache2/httpd)
ReferenceImportant terms & boundaries6 sections · depth on demand

What this shows and what it does not

Nginx is resolved only when the intended server and location handle the exact client request and any upstream returns the expected application result.

In depth

nginx: worker model, configuration and TLS defaults

nginx is an event-driven web server and reverse proxy. A master process reads the configuration, and a small number of worker processes handle all connections. The nginx guide to HTTPS servers documents several defaults worth knowing:

  • ssl_protocols TLSv1.2 TLSv1.3 and ssl_ciphers HIGH:!aNULL:!MD5 are the defaults, so they normally don't need to be set.
  • The certificate file must list the server certificate first, then the intermediates. Otherwise nginx refuses to start with "key values mismatch".
  • The private key must be readable by the master process.
  • One megabyte of shared session cache holds about 4,000 sessions, and the default session timeout is 5 minutes.
  • worker_processes should be at least the number of CPU cores, because TLS handshakes are CPU-intensive.
  • HTTP and HTTPS can share one server block, using listen 443 ssl. The old ssl on directive was removed in 1.25.1.

Configuration structure

ContextHolds
mainworker_processes, user, error_log
eventsworker_connections
httpShared settings: logs, gzip, TLS session cache, include of sites
serverOne site: listen, server_name, certificates
locationHandling for matching URIs: root, proxy_pass, try_files

Layout by distribution

Debian / UbuntuRHEL family / upstream packages
Sitessites-available/ + symlink in sites-enabled/conf.d/*.conf
Web root default/var/www/html/usr/share/nginx/html
host$ cat /etc/nginx/conf.d/www.conf
server {
    listen 80;
    listen 443 ssl;
    http2 on;
    server_name www.example.net example.net;

    ssl_certificate     /etc/ssl/certs/www.example.net.fullchain.pem;
    ssl_certificate_key /etc/ssl/private/www.example.net.key;

    root /srv/www/example;
    location / { try_files $uri $uri/ =404; }
}
host$ sudo nginx -t && sudo systemctl reload nginx
host$ ps -o pid,user,cmd -C nginx
    PID USER     CMD
   1203 root     nginx: master process /usr/sbin/nginx
   1204 www-data nginx: worker process
host$ nginx -V 2>&1 | grep -o "TLS SNI support enabled"
host$ curl -sI https://www.example.net | head -1

Reload is graceful

nginx -s reload, or systemctl reload, starts new workers with the new configuration, and lets old workers finish their current requests. A configuration that fails nginx -t is never applied, so always test first. The running configuration then stays in place.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

Nginx is part of Web Services → Nginx. Nginx on Linux is verified from parsed configuration and master/worker runtime state through listen/server_name selection, location processing, TLS, static-file or upstream handling and the client-visible response.

Topic-specific state model. Nginx on Linux is verified from parsed configuration and master/worker runtime state through listen/server_name selection, location processing, TLS, static-file or upstream handling and the client-visible response.

Interpretation rule. - nginx -t success ≠ the intended server block is selected.

  • Nginx running ≠ an upstream application is healthy.
  • A 200 response ≠ it came from the intended location or backend.
  • Reload accepted ≠ every worker immediately reflects a semantically correct configuration.

Specialized mechanics

Nginx uses a master process to load configuration and manage worker processes that accept connections and execute request-processing phases. Server block selection depends on listen address/port and host/SNI, while location selection determines content/proxy behavior within the chosen server. A graceful reload causes the master to parse new configuration, start new workers and retire old workers, so old and new worker generations can briefly coexist. Directive inheritance is context-specific, so moving a directive between http, server and location scopes can materially change the effective request path.

Quick reference

Nginx essentials:

nginx -t && systemctl reload nginx
nginx -T | less                   # full effective config
/etc/nginx/nginx.conf, /etc/nginx/conf.d/*.conf, (Debian) sites-enabled/

Key directives:

DirectiveNote
worker_processes auto;One per CPU
worker_connections 4096;Per worker
server_nameHost matching, default_server for unmatched
locationPrefix, exact (=), regex (~) matching order
client_max_body_sizeUpload limit (413 errors)
proxy_read_timeoutUpstream timeouts (504)

Reload is graceful — old workers finish requests; restart drops connections.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. Nginx is resolved only when the intended server and location handle the exact client request and any upstream returns the expected application result.

Apache/Nginx config syntax success is not application health.

ReferenceConfiguration & state2 sections · depth on demand

Configuration, persistence and lifecycle

Validate Apache/Nginx configuration before reload and understand virtual-host/SNI/default-server selection.

Distribution/platform context. Nginx owns server/location and proxy behavior; Certificates & TLS, DNS, Firewall and application upstreams own their separate boundaries.

Specialized lifecycle

Keep configuration modular but make include order and ownership explicit. Run the configuration test before reload and use a graceful reload for supported changes. Define default servers intentionally so unmatched Host/SNI requests do not land in a sensitive virtual host. For TLS, coordinate certificate/key paths and reload timing. For reverse proxying, treat upstream, headers and timeout policy as application contract rather than relying on defaults. Avoid editing generated configs when a control panel/orchestrator owns them.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Web Services → Nginx. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://nginx.org/en/docs/ · confidence 94%
2026-09-13 · vendor docNGINX current

Authoritative Linux project/vendor documentation reviewed for bounded reference claims: configuration structure, reload behavior, server selection and request handling. Documentation-based technical verification only; not lab or production-runtime proof. The schema vendor_doc method is used for authoritative project/vendor documentation; deployment applicability remains separate evidence.

Basis: https://nginx.org/en/docs/beginners_guide.html · confidence 93%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
nginxnginx linuxnginx web server
Embedded reference data

Quick lookup tables

Nginx operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for Nginx.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateNginx on Linux is verified from parsed configuration and master/worker runtime state through listen/server_name selection, location processing, TLS, static-file or upstream handling and the client-visible response.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin exact client/server + time + request/file operation → identify authoritative configuration → read back effective service/listener/session state → trace protocol selection/auth/identity → verify backend/upstream boundary → correlate logs → make smallest persistent change → repeat original workload + regression check.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainnginx config/includes → syntax/effective dump → master/workers → listen socket → server_name/SNI → location selection → file/proxy/upstream → response/logTrace requested/configured state through effective state to the observed workload result.
Failure boundaryNginx closes only when the intended server and location handle the exact client request and any upstream returns the expected application result.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux web/file-service evidence can establish this proof path: nginx config/includes → syntax/effective dump → master/workers → listen socket → server_name/SNI → location selection → file/proxy/upstream → response/logUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove unobserved clients, names, identities, routes, sessions, backends or time periods. Nginx closes only when the intended server and location handle the exact client request and any upstream returns the expected application result.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven service boundary, capture adjacent effective state and protocol/application evidence, make only the demonstrated persistent change, then repeat the original client workload plus a regression check.Continue to the next unresolved boundary while preserving the original test condition.

Nginx · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundaryNginx
Topic pathWeb Services → Nginx
Runtime stateNginx on Linux is verified from parsed configuration and master/worker runtime state through listen/server_name selection, location processing, TLS, static-file or upstream handling and the client-visible response.
Fast checks- Pin effective config, listener, requested scheme/Host/path and expected upstream or document root. - Validate and inspect the parsed configuration, process state and socket ownership. - Send the exact request while correlating access/error logs and upstream status or filesystem access. - Make the smallest persistent change, reload, and repeat the original request plus one neighboring route.
Verification chainnginx config/includes → syntax/effective dump → master/workers → listen socket → server_name/SNI → location selection → file/proxy/upstream → response/log Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary.
Failure boundaryNginx closes only when the intended server and location handle the exact client request and any upstream returns the expected application result. Boundary chain: unit config/drop-ins → dependency/order/condition → exec/process → readiness/active state → owned socket/file/device → dependent client/workload.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.

Nginx · specialized operational reference

Topic-specific Linux mechanics, lifecycle, proof path and failure-boundary lookup.

Operational boundaryTopic-specific reference
Selectionlisten → server_name/SNI → location
LifecycleMaster parses; graceful reload rotates workers
ProofExact host/path client request + correlated access/error logs
BoundaryFrontend health separate from upstream/application
Confirmation

Confirm action

Continue?