Nginx / Apache errors

Nginx and Apache web server errors — config tests, upstream timeouts, PHP-FPM, permissions and virtual hosts.

CodeErrorWhat it means
nginx: [emerg] unknown directive Nginx: nginx: [emerg] unknown directive "x" in /etc/nginx/sites-enabled/x:12 — configuration file test failed Nginx found a directive it doesn’t know — a typo, a missing semicolon on the previous line, a directive from…
upstream timed out Nginx: upstream timed out (110: Connection timed out) while reading response header from upstream Nginx waited longer than proxy_read_timeout (60 s default) for the backend (app server, PHP-FPM) to respond,…
AH00558 Apache: AH00558: apache2: Could not reliably determine the server's fully qualified domain name A harmless startup warning: Apache has no global ServerName, so it guessed one from the host’s IP.
SSL_do_handshake() failed while SSL handshaking to upstream Nginx: [error] SSL_do_handshake() failed (SSL: error:0A000410:SSL routines::sslv3 alert handshake failure) while SSL handshaking to upstream Nginx couldn't complete TLS to an HTTPS backend (`proxy_pass https://...`), so clients get 502.
nginx: host not found in upstream Nginx: nginx: [emerg] host not found in upstream "app" in /etc/nginx/conf.d/default.conf:5 Nginx couldn't resolve the hostname in an `upstream`/`proxy_pass` at startup.
AH00072: make_sock: could not bind to address 0.0.0.0:80 Apache: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80 / AH00015: Unable to open logs Another process (Nginx, another Apache, Skype/IIS-like service) already listens on the port Apache wants.
AH00898: Error reading from remote server (502 Proxy Error) Apache: [proxy_http:error] AH01102: error reading status line from remote server 127.0.0.1:3000 / AH00898: Error reading from remote server returned by /api mod_proxy couldn't read a valid response from the backend, so Apache returned 502/503.
AH01114: HTTP: failed to make connection to backend Apache: [proxy:error] AH00957: HTTP: attempt to connect to 127.0.0.1:3000 (127.0.0.1) failed / AH01114: HTTP: failed to make connection to backend: 127.0.0.1 mod_proxy couldn't connect to the backend address, so the client gets 503/502.
AH00015: Unable to open logs Apache: AH00091: apache2: could not open error log file /var/log/apache2/error.log. AH00015: Unable to open logs (Permission denied) Apache can't open its log files — permissions, a missing directory or disk problems.
AH00112: DocumentRoot does not exist Apache: AH00112: Warning: DocumentRoot [/var/www/example.com/public_html] does not exist A virtual host points to a directory that doesn't exist.
AH00124: Request exceeded the limit of 10 internal redirects Apache: AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary Rewrite rules loop internally, so Apache aborts with a 500.
upstream prematurely closed connection while reading response header Nginx: [error] upstream prematurely closed connection while reading response header from upstream The backend ended the connection before sending a complete response header.
499 Client Closed Request / client prematurely closed connection Nginx: [info] client prematurely closed connection while reading response header from upstream / access log status 499 The client (browser, mobile app, load balancer) disconnected before Nginx finished the response; Nginx logs s…
FastCGI sent in stderr: PHP message Nginx: [error] FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect()" while reading response header from upstream PHP wrote an error to stderr while handling the request, so Nginx logs it (often a 500/502 follows).
open() failed (13: Permission denied) Nginx: [error] open() "/home/user/site/index.html" failed (13: Permission denied), 403 Forbidden The nginx worker user can't read the requested file or traverse a parent directory.
414 Request-URI Too Large / 400 Request Header Or Cookie Too Large Nginx: 400 Bad Request — Request Header Or Cookie Too Large / client sent too long header line The request line or headers (often cookies) exceed `large_client_header_buffers`.
nginx: directive is not terminated by ";" Nginx: nginx: [emerg] directive "proxy_pass" is not terminated by ";" in /etc/nginx/sites-enabled/app:15 A directive's arguments run into the next line because the `;` is missing (or a quote is unbalanced).
nginx: [emerg] unexpected end of file, expecting ";" or "}" Nginx: nginx: [emerg] unexpected end of file, expecting ";" or "}" in /etc/nginx/conf.d/site.conf:42 The config ends while a block or directive is still open — a missing `}` or `;`.
ModSecurity: Access denied with code 403 Nginx/Apache: ModSecurity: Access denied with code 403 (phase 2). Matched "Operator GE matched 5 at TX:anomaly_score" The ModSecurity WAF (OWASP Core Rule Set) blocked the request as suspicious.
apache2.service: Failed with result 'exit-code' systemd: apache2.service: Main process exited, code=exited, status=1/FAILURE — Job for apache2.service failed because the control process exited with error code systemd couldn't start Apache — the real error is in the journal or `apachectl configtest`.
AH00128: File does not exist Apache: [core:info] AH00128: File does not exist: /var/www/html/favicon.ico (404) The requested file isn't in the DocumentRoot — a normal 404 entry in the Apache error log.
AH00288: scoreboard is full, not at MaxRequestWorkers Apache: [mpm_event:error] AH00288: scoreboard is full, not at MaxRequestWorkers. Increase ServerLimit The shared scoreboard (process table) has no free slot even though the request limit isn't reached.
WebSocket connection failed through Nginx (missing Upgrade headers) Browser: WebSocket connection to 'wss://example.com/socket' failed: Error during WebSocket handshake: Unexpected response code: 400 (nginx proxy) Nginx isn't forwarding the `Upgrade`/`Connection` headers needed for WebSockets.
Welcome to nginx! shown instead of my site Browser: Welcome to nginx! If you see this page, the nginx web server is successfully installed and working Requests are served by the default server block, not your site's block.
accept4() failed (24: Too many open files) Nginx: [crit] accept4() failed (24: Too many open files) / open() failed (24: Too many open files) Nginx workers hit the file-descriptor limit and can't accept or open more.
connect() to unix:/run/php/php-fpm.sock failed (13: Permission denied) Nginx: [crit] connect() to unix:/run/php/php8.3-fpm.sock failed (13: Permission denied) while connecting to upstream Nginx can't open the PHP-FPM (or app) Unix socket because of socket ownership/permissions or SELinux.
nginx: client intended to send too large body Nginx: [error] client intended to send too large body: 5242880 bytes (413 Request Entity Too Large) A request body exceeded `client_max_body_size` (default 1 MB), so Nginx returned 413 before reaching your app.
no live upstreams while connecting to upstream Nginx: [error] no live upstreams while connecting to upstream (503/502) All servers in an `upstream` group are marked unavailable, so Nginx has nothing to proxy to.
upstream sent too big header while reading response header Nginx: [error] upstream sent too big header while reading response header from upstream (502 Bad Gateway) The backend's response headers (cookies, Set-Cookie, long headers) exceeded Nginx's proxy/fastcgi buffer size.
AH01630: client denied by server configuration Apache: [authz_core:error] AH01630: client denied by server configuration: /var/www/html/ Apache 2.4 authorisation denied access to the directory (403) because no `Require all granted` applies.
AH01276: Cannot serve directory: No matching DirectoryIndex Apache: [autoindex:error] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive A directory was requested, no index file exists, and directory listing (`Options Indexes`) isn't enabled.
.htaccess: Invalid command (500 Internal Server Error) Apache: [core:alert] /var/www/html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration A `.htaccess` file uses a directive the server can't handle, causing 500 errors for the whole directory.
AH00037: Symbolic link not allowed or link target not accessible Apache: [core:error] AH00037: Symbolic link not allowed or link target not accessible: /var/www/html/current Apache refuses to follow a symlink because `FollowSymLinks`/`SymLinksIfOwnerMatch` isn't allowed or the targe…
AH00548: NameVirtualHost has no effect Apache: [core:warn] AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/ports.conf:5 Apache 2.4 ignores the old `NameVirtualHost` directive — a harmless warning from a config written for 2.2.
AH00161: server reached MaxRequestWorkers setting Apache: [mpm_event:error] AH00484: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting Apache used all its worker slots, so new requests queue or time out.
AH00526: Syntax error on line of apache config Apache: AH00526: Syntax error on line 12 of /etc/apache2/sites-enabled/site.conf: Invalid command 'Foo', perhaps misspelled or defined by a module not included in the server configuration Apache's config has a syntax problem or a directive from a module that isn't loaded.
PHP file downloads instead of running (Nginx) Browser downloads index.php instead of rendering — Nginx has no fastcgi PHP location Nginx serves `.php` files as static downloads because no `location ~ \.php$` passes them to PHP-FPM.
Apache shows PHP source or downloads .php files Browser shows <?php code or downloads index.php — mod_php / PHP-FPM handler not configured in Apache Apache serves PHP files as plain text because no PHP handler is active.
limiting requests, excess: (503 from limit_req) Nginx: [error] limiting requests, excess: 5.370 by zone "perip", client: 203.0.113.5 `limit_req` rejected requests because the client exceeded the configured rate (burst) — response 503 (or 429).
no resolver defined to resolve example.com Nginx: [error] no resolver defined to resolve api.example.com, client: 203.0.113.5 (502 when proxy_pass uses a variable) `proxy_pass` with a variable (or `set $upstream`) needs a `resolver`, which isn't configured.
recv() failed (104: Connection reset by peer) while reading response header Nginx: [error] recv() failed (104: Connection reset by peer) while reading response header from upstream The upstream (PHP-FPM, Node, Gunicorn) closed the connection abruptly while Nginx waited for the response.
nginx: duplicate location Nginx: nginx: [emerg] duplicate location "/" in /etc/nginx/sites-enabled/default:52 Two `location` blocks with the same match exist in one server block (often from two included files).
nginx: invalid PID number in nginx.pid Nginx: nginx: [error] invalid PID number "" in "/run/nginx.pid" (when running nginx -s reload) Nginx can't signal the master process because the PID file is empty, stale or missing.
worker_connections are not enough Nginx: [alert] 1234#1234: *987 1024 worker_connections are not enough while connecting to upstream Nginx ran out of simultaneous connection slots in a worker.
connect() failed (111: Connection refused) while connecting to upstream Nginx: [error] connect() failed (111: Connection refused) while connecting to upstream, upstream: "http://127.0.0.1:3000/" Nginx tried to proxy a request but nothing listens on the upstream address, so the client gets 502.
rewrite or internal redirection cycle Nginx: [error] rewrite or internal redirection cycle while internally redirecting to "/index.php" (500 Internal Server Error) Nginx kept internally redirecting (more than 10 times), typically from a `try_files` or `rewrite` that points…
nginx: bind() to 0.0.0.0:80 failed (13: Permission denied) Nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied) Nginx isn't allowed to bind that port — a privileged port as non-root, or SELinux restricts it.
nginx: [emerg] open() failed (2: No such file or directory) Nginx: nginx: [emerg] open() "/etc/nginx/snippets/fastcgi-php.conf" failed (2: No such file or directory) in /etc/nginx/sites-enabled/app:20 The config includes a file (snippet, certificate, ssl option file) that doesn't exist.
the "listen ... http2" directive is deprecated Nginx: nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead Since Nginx 1.25.1 HTTP/2 is enabled with a separate `http2 on;` directive instead of `listen 443 ssl http2;`.
proxy_pass with a URI changes the path (404 from upstream) Nginx: reverse proxy returns 404 — location /api/ { proxy_pass http://app:3000/; } strips the prefix (or keeps it) Whether `proxy_pass` has a URI part decides if the matched prefix is stripped, so the backend receives an une…
directory index of "/var/www/" is forbidden Nginx: [error] directory index of "/var/www/html/" is forbidden (403 Forbidden) A directory was requested but no index file exists (or index is wrong) and autoindex is off, so Nginx returns…
could not build the server_names_hash, you should increase server_names_hash_bucket_size Nginx: nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 64 A very long `server_name` (or many names) doesn't fit the hash bucket.
nginx: conflicting server name ignored Nginx: nginx: [warn] conflicting server name "example.com" on 0.0.0.0:80, ignored Two server blocks listen on the same port with the same `server_name`; the second is ignored.