Nginx logs 42
- nginx "proxy_cache" zone … is unknown
Fix nginx "proxy_cache" zone is unknown by matching the name to keys_zone in proxy_cache_path and checking that nginx reads the declaration file.
nginx 1.28.0 (Docker) · 2026-11 - Fix nginx duplicate upstream
Fix nginx duplicate upstream by finding the second upstream block with the same name, then merging the servers into one block or renaming one group.
nginx 1.28.0 (Docker) · 2026-11 - Fix nginx location cannot be inside the exact location
Fix nginx location cannot be inside the exact location by moving the inner location out of the = block into a sibling position, then rerun nginx -t.
nginx 1.28.0 (Docker) · 2026-11 - nginx the "large_client_header_buffers" size must be equal to or greater than "connection_pool_size"
Compare the size of one large_client_header_buffers buffer with connection_pool_size when nginx -t fails. Increasing the buffer count leaves the error in place.
nginx 1.28.0 (Docker) · 2026-11 - nginx empty regex in server name "~"
Fix empty regex in server name "~" in nginx. Check for a space after the tilde, attach the pattern to it, or use an exact host name.
nginx 1.28.0 (Docker) · 2026-11 - nginx the "alias" directive cannot be used inside the named location
Fix an alias inside a named nginx location. Map files under a URI prefix, or keep the fallback internal and update the try_files target.
nginx 1.28.0 (Docker) · 2026-11 - Fix nginx invalid URL prefix in proxy_pass
Fix nginx invalid URL prefix by checking the proxy_pass scheme, choosing HTTP or HTTPS to match the backend, and retesting the configuration.
nginx 1.28.0 (Docker) · 2026-11 - Fix nginx "open_file_cache" must have the "max" parameter
Fix the nginx open_file_cache error by adding max=N to enable the cache or using off to disable it. Verify the change with nginx -t.
nginx 1.28.0 (Docker) · 2026-11 - Fix nginx block directives are not supported in -g option
Move blocks such as events out of the nginx -g argument and into the right context in nginx.conf, then verify the corrected command with nginx -t.
nginx 1.28.0 (Docker) · 2026-11 - Fix nginx no servers are inside upstream
Fix nginx no servers are inside upstream by finding the empty group, adding an actual backend server, and checking the configuration with nginx -t.
nginx 1.28.0 (Docker) · 2026-11 - nginx log location: find and read access.log, error.log
Find the nginx log location, see why the Docker image needs docker logs, read one line of each log, and jump to the right fix for your symptom.
nginx 1.30.6 (Docker nginx:stable) · distro paths per nginx docs · 2026-11 - HTTP 420 Status Code Is Not Standard — What to Do
HTTP 420 is unassigned in the IANA status code registry. See what RFC 9110 says about unknown 4xx codes and how to read the body and headers of a 420.
IANA HTTP Status Code Registry (2025-09-15) · RFC 9110 · RFC 6585 · nginx 1.30.6 (Docker) · 2026-11 - Fix nginx "duplicate listen options for 0.0.0.0:80"
nginx "duplicate listen options for 0.0.0.0:80": two listen lines on one address:port both set socket options like reuseport or backlog. Keep them on one.
nginx 1.30.6 (Docker nginx:stable) · 2026-10 - Fix nginx [emerg] duplicate location "/path" in ...
nginx -t "[emerg] duplicate location" means one server block defines the same location path twice. Find both files with grep -Rn and keep one.
nginx 1.30.6 (Docker nginx:stable) · 2026-10 - Fix nginx "(24: Too many open files)"
nginx "accept4() failed (24: Too many open files)" means a worker hit its open-file limit. Check Max open files, then raise it with worker_rlimit_nofile.
nginx 1.30.6 (Docker nginx:stable) · 2026-10 - Fix nginx directive has no opening "{"
nginx 'directive has no opening "{"' means a block directive such as location, if or upstream ended with ";" instead of "{". Fix the statement, test, reload.
nginx 1.30.6 (Docker) · 2026-11 - Add response times to the Nginx log and find slow requests
The default Nginx log has no timing. Add request_time and upstream_response_time with log_format, then find slow requests and slow paths with awk.
Ubuntu 24.04 · nginx 1.24.0 · GNU awk 5.2.1 · log generated behind a test backend - Fix nginx directive is not terminated by ";"
nginx 'directive is not terminated by ";"' means a "{" followed a directive with no semicolon. Fix the named line, and tell it apart from look-alike errors.
nginx 1.30.6 (Docker) · 2026-11 - Change Nginx limit_req from 503 to 429 Too Many Requests
limit_req rejects requests with 503 by default, like an outage. Confirm it in error.log, switch to 429 with limit_req_status, compare burst/nodelay.
Ubuntu 24.04 · Nginx 1.24.0 (tested with curl) - Fix nginx "invalid number of arguments in directive" error
nginx "invalid number of arguments" means a directive got too many or too few values. Look for a missing semicolon, an unquoted space or a missing argument.
nginx 1.30.6 (Docker) · 2026-11 - Nginx bind() to 0.0.0.0:80 failed (98: Address already in use)
Another process already listens on the port Nginx wants. Find it with ss, and see why a failed reload leaves the old configuration serving traffic.
Ubuntu 24.04.5 · Nginx 1.24.0 · iproute2 6.1.0 (ss) · reproduced on ports in the 18800 range - Redact ?token= from nginx access logs with map (tested)
Keep ?token= values out of nginx access logs with a map variable in log_format. Nine test requests show what still leaks, including the error log.
nginx 1.30.6 (Docker) · curl · 2026-10 - Fix nginx "could not build server_names_hash" (bucket_size)
nginx "could not build server_names_hash" means one server_name is too long for the bucket. Set server_names_hash_bucket_size 128 once in http.
nginx 1.30.6·1.31.8 (Docker) · Ubuntu 24.04 nginx 1.24.0 · 2026-10 - nginx 1.31.7: new SSL_read() failed (104) lines after upgrade
Since nginx 1.31.7, a client resetting a TLS connection is logged as SSL_read() failed (104) at info level. Tested against 1.31.6 with three close methods.
nginx 1.30.6, 1.31.6, 1.31.7 (Docker) · Python 3.12 ssl client · 2026-10 - Fix nginx "conflicting server name ... on 0.0.0.0:80, ignored"
nginx "conflicting server name ... ignored": two server blocks share a name on one address:port and the later is ignored. Find it with nginx -T.
nginx 1.30.6·1.31.8 (Docker) · Ubuntu 24.04 nginx 1.24.0 · 2026-10 - Fix nginx: the "listen ... http2" directive is deprecated
nginx 1.25.1+ warns "listen ... http2" is deprecated. Drop http2 from each listen line and add http2 on; per server. On 1.24 (Ubuntu 24.04) http2 on fails.
nginx 1.30.6·1.31.8 (Docker) · Ubuntu 24.04 nginx 1.24.0 · 2026-10 - Fix nginx unexpected end of file, expecting } (nginx -t)
nginx -t says unexpected end of file, expecting "}" when a { in that file is never closed. The line number is the file's end; find the gap by brace depth.
nginx 1.30.6 (Docker) · 2026-10 - Fix nginx 500: rewrite or internal redirection cycle (try_files)
A 500 with rewrite or internal redirection cycle means the last try_files target is missing under root. Create that file or end try_files with =404.
nginx 1.30.6 (Docker) · 2026-10 - Fix nginx: a duplicate default server for 0.0.0.0:80
nginx -t says a duplicate default server for 0.0.0.0:80? Two listen lines on the same port have default_server. Find the Ubuntu default site and keep only one.
Ubuntu 24.04 · nginx 1.24.0 (Docker) · 2026-10 - Fix nginx: no ssl_certificate is defined for listen ... ssl
nginx says no ssl_certificate is defined for listen ... ssl when a port's default server lacks a certificate. Add one there or use ssl_reject_handshake.
nginx 1.30.6 (Docker) · OpenSSL 3.5.7 · 2026-10 - Fix nginx proxy_pass cannot have URI part in regex location
nginx rejects proxy_pass with a path (even a trailing /) in a regex location or if block. Drop the path and use rewrite … break, or use a prefix location.
nginx 1.30.6 (Docker) · 2026-10 - Fix nginx: no resolver defined to resolve (variable proxy_pass)
A variable in proxy_pass makes nginx resolve names per request. Fix no resolver defined and the 502 with a resolver line or an upstream block.
nginx 1.30.6 (Docker) · 2026-10 - Fix broken nginx JSON access logs with escape=json
An nginx JSON log_format without escape=json breaks on quotes, non-ASCII and control characters. Seven requests compare jq parsing in three escape modes.
nginx 1.30.6 (Docker) · jq 1.7 · Python 3.12 · 2026-10 - Fix nginx SSL_CTX_use_PrivateKey failed: key values mismatch
nginx fails with key values mismatch? Hash the public keys of the first certificate and the private key to tell a wrong key from a reversed chain.
nginx 1.30.6 (Docker) · OpenSSL 3.5.7 · 2026-10 - nginx 1.31.8 working_directory now relative to prefix: check it
nginx 1.31.8 resolves a relative working_directory against the prefix. A missing path leaves 1.31.7 running with no workers; 1.31.8 refuses to start.
nginx 1.31.7, 1.31.8 (official Docker images, prefix /etc/nginx) · 2026-10 - nginx cannot load certificate key (PEM_read_bio_PrivateKey)
Fix nginx cannot load certificate key by the function in brackets: BIO_new_file is path or permissions; PEM_read_bio_PrivateKey is wrong file or passphrase.
nginx 1.30.6 (Docker) · OpenSSL 3.5.7 · 2026-10 - Fix Nginx "upstream prematurely closed connection" (502)
Nginx 502 with "upstream prematurely closed connection" means the backend hung up mid-response. Tell a 502 from a truncated 200, then check the backend log.
nginx 1.28.3 (Docker) · Python 3.12 (test upstream) · 2026-10 - Nginx 504 upstream timed out — Tell Which Timeout Fired
The end of the 504 line in error.log (connecting, reading, sending) names the timeout that fired. Defaults and access-log time variables, with real logs.
Ubuntu 24.04 · Nginx 1.24.0 · Python 3.12 (test backend) - Fix Nginx 413 Request Entity Too Large with client_max_body_size
Upload failing with 413? Find the too large body line in error.log and raise client_max_body_size. Covers the 1m default, which block wins and what 0 means.
Ubuntu 24.04 · Nginx 1.24.0 (tested with curl 8.5.0) - Fix Nginx 502 "upstream sent too big header"
A 502 caused by response headers larger than proxy_buffer_size. Read the error line, adjust buffer values, avoid combinations nginx rejects, and FastCGI.
Ubuntu 24.04 · Nginx 1.24.0 · Python 3.12 (test backend) - Tell the cause of an Nginx 502 Bad Gateway from error.log
The access log only says 502. Match four error.log messages to their causes and the command that confirms each, and tell them apart from a 504.
Ubuntu 24.04.5 · Nginx 1.24.0 · Python 3.12 (test backends) - Find which paths return 5xx in an Nginx access log
Count server errors per path with awk, merge query strings, and narrow by status code and time window — one-liners for the default combined format.
Nginx combined log format · GNU awk 5.2 · generated test log (Ubuntu 24.04)