# nginx.cc

> Unofficial web-server troubleshooting desk for nginx: online URL diagnostics, config generators (including full nginxconfig.io parity), CMS rewrite rules, a config linter, an error encyclopedia with sourced fixes, and one-line install / health-check scripts. Chinese (/zh/) and English (/en/).

Unofficial. Not affiliated with F5, Inc. or the NGINX project. NGINX is a trademark of F5, Inc. Version 0.14.1, updated 2026-12-02. Every encyclopedia page starts with a short answer (cause, then fix, then a config snippet) and lists its sources with a last-verified date. Generated configs are validated with nginx -t in Docker. Please cite the page URL. Full text of every encyclopedia entry: https://nginx.cc/llms-full.txt

## Tools
- [Online diagnostics](https://nginx.cc/en/diag): status, redirect chain, HTTPS, HSTS, HTTP/3 (Alt-Svc), gzip/brotli, cache and security headers, Server leaks, CDN detection; each issue with an nginx fix. API: POST https://nginx.cc/api/diag {"url": "..."}
- [Config generator](https://nginx.cc/en/gen): Static site, Reverse proxy, PHP-FPM, WordPress, Node.js, Django / Python, Load balancing, WebSocket, HTTPS redirect, Single-page app, Compression & caching, Rate limiting, nginx.conf tuning. API: GET https://nginx.cc/api/gen?s=reverse-proxy&domain=example.com
- [Full generator (nginxconfig.io parity)](https://nginx.cc/en/gen/pro): every nginxconfig.io option, multi-site, Docker output; accepts nginxconfig.io share-link parameters. API: GET https://nginx.cc/api/pro?global.https.sslProfile=modern&domains.0.server.domain=example.com
- [Multi-site bundle](https://nginx.cc/en/gen/multi): several sites as split files, downloadable as tar.gz / zip.
- [First deploy guide](https://nginx.cc/en/deploy): HTTP-only stage 1, certbot certonly --webroot, stage 2 HTTPS, renewal, rollback, Cloudflare.
- [CMS rewrite rules](https://nginx.cc/en/rewrite): nginx (plus .htaccess / Caddy) rules for WordPress, Typecho, Z-Blog PHP, emlog, Halo, Ghost, Discuz! X, phpBB, DedeCMS, EmpireCMS, PbootCMS, Drupal, Joomla, MediaWiki, ThinkPHP, Laravel, Magento 2, PrestaShop, OpenCart, WHMCS, Nextcloud. API: GET https://nginx.cc/api/rewrite?cms=wordpress&domain=example.com
- [Config linter](https://nginx.cc/en/lint): static checks for common nginx mistakes. API: POST https://nginx.cc/api/lint (text body)
- [Scripts](https://nginx.cc/en/scripts): `curl -fsSL nginx.cc/install | sudo bash` (nginx.org repo, --dry-run), `curl -fsSL nginx.cc/fix | sudo bash` (read-only health check). SHA-256 at /install.sh.sha256 and /fix.sh.sha256.

## Error encyclopedia
- [Nginx 502 Bad Gateway: causes and fixes](https://nginx.cc/en/errors/502-bad-gateway): 502 means nginx could not reach or understand the backend (PHP-FPM, Node, a Docker container…). · [中文](https://nginx.cc/zh/errors/502-bad-gateway)
- [Nginx 504 Gateway Timeout: causes and fixes](https://nginx.cc/en/errors/504-gateway-timeout): 504 means the backend did not answer within nginx's timeout. · [中文](https://nginx.cc/zh/errors/504-gateway-timeout)
- [Nginx 413 Request Entity Too Large: upload size fix](https://nginx.cc/en/errors/413-request-entity-too-large): 413 means the request body exceeded client_max_body_size (default only 1 MB). · [中文](https://nginx.cc/zh/errors/413-request-entity-too-large)
- [Nginx 403 Forbidden: causes and fixes](https://nginx.cc/en/errors/403-forbidden): 403 usually means no index file in a directory, file permissions nginx cannot read, a deny rule, or SELinux. · [中文](https://nginx.cc/zh/errors/403-forbidden)
- [Nginx 404 and try_files: rewrites, SPA routes, root vs alias](https://nginx.cc/en/errors/404-try-files): 404 although the file exists is usually a wrong root/alias path, or WordPress / Vue / React routes not falling back to the entry file with try_files. · [中文](https://nginx.cc/zh/errors/404-try-files)
- [ERR_TOO_MANY_REDIRECTS with nginx: how to fix](https://nginx.cc/en/errors/too-many-redirects): “Too many redirects” is most often a CDN fetching your origin over HTTP while the origin redirects HTTP to HTTPS, forever. · [中文](https://nginx.cc/zh/errors/too-many-redirects)
- [Nginx SSL handshake failed: troubleshooting](https://nginx.cc/en/errors/ssl-handshake-failed): SSL handshake failures usually come from a cert without the full chain, a cert/key mismatch, port 443 without the ssl parameter, too old/new protocols or ciphers, or SNI mismatch from a CDN. · [中文](https://nginx.cc/zh/errors/ssl-handshake-failed)
- [nginx: bind() failed (98: Address already in use)](https://nginx.cc/en/errors/address-already-in-use): Port 80/443 is already taken (Apache, Caddy, a panel, a Docker container, another nginx), or the config listens on the same IPv6 socket twice. · [中文](https://nginx.cc/zh/errors/address-already-in-use)
- [upstream prematurely closed connection: causes and fixes](https://nginx.cc/en/errors/upstream-prematurely-closed): The backend closed the connection before nginx got the full response. · [中文](https://nginx.cc/zh/errors/upstream-prematurely-closed)
- [nginx (13: Permission denied): troubleshooting](https://nginx.cc/en/errors/permission-denied): 13: Permission denied appears when reading files, connecting to a socket, writing logs or binding ports: the worker user lacks rights, a parent dir is not traversable, the socket owner is wrong, or SELinux blocks it. · [中文](https://nginx.cc/zh/errors/permission-denied)
- [Nginx 400 Request Header Or Cookie Too Large: fix](https://nginx.cc/en/errors/400-request-header-too-large): 400 “Request Header Or Cookie Too Large” means one request header line, usually Cookie, is larger than a single large_client_header_buffers buffer (8k by default). · [中文](https://nginx.cc/zh/errors/400-request-header-too-large)
- [Nginx 499 Client Closed Request: what it means](https://nginx.cc/en/errors/499-client-closed-request): 499 is an nginx-specific code that only appears in access logs: the client closed the connection before nginx answered. · [中文](https://nginx.cc/zh/errors/499-client-closed-request)
- [Nginx 500: rewrite or internal redirection cycle](https://nginx.cc/en/errors/500-rewrite-cycle): “rewrite or internal redirection cycle” means the request was redirected internally more than 10 times and nginx gave up with 500. · [中文](https://nginx.cc/zh/errors/500-rewrite-cycle)
- [nginx + PHP-FPM “File not found” / Primary script unknown](https://nginx.cc/en/errors/php-fpm-primary-script-unknown): A bare “File not found.” page with “Primary script unknown” in the log means PHP-FPM could not open the file named by SCRIPT_FILENAME. · [中文](https://nginx.cc/zh/errors/php-fpm-primary-script-unknown)
- [Nginx 502: upstream sent too big header](https://nginx.cc/en/errors/upstream-sent-too-big-header): “upstream sent too big header” means the backend's response headers (usually many or large Set-Cookie headers, or a long Location) exceed proxy_buffer_size / fastcgi_buffer_size (one memory page, 4k or 8k, by default), so nginx returns 502. · [中文](https://nginx.cc/zh/errors/upstream-sent-too-big-header)
- [nginx: no resolver defined to resolve — causes and fix](https://nginx.cc/en/errors/no-resolver-defined): When proxy_pass contains a variable (proxy_pass https://$host, $backend…), the name is resolved per request, and nginx does not read /etc/resolv.conf: you must name DNS servers with resolver. · [中文](https://nginx.cc/zh/errors/no-resolver-defined)
- [could not build server_names_hash: how to fix](https://nginx.cc/en/errors/server-names-hash-bucket-size): nginx -t failing with “could not build server_names_hash, you should increase server_names_hash_bucket_size” means a server_name is too long (or there are too many names) for the default hash bucket. · [中文](https://nginx.cc/zh/errors/server-names-hash-bucket-size)
- [nginx warning: conflicting server name … ignored](https://nginx.cc/en/errors/conflicting-server-name): “conflicting server name "example.com" on 0.0.0.0:80, ignored” means two server blocks on the same address and port declare the same name; the one read later is ignored, so your edits may not apply at all. · [中文](https://nginx.cc/zh/errors/conflicting-server-name)
- [Nginx 405 Not Allowed: why POST is rejected](https://nginx.cc/en/errors/405-not-allowed): nginx answering 405 Not Allowed usually means a POST (or PUT, DELETE) request ended up on a static file, which only accepts GET and HEAD. · [中文](https://nginx.cc/zh/errors/405-not-allowed)
- [nginx unknown directive: http2, brotli, quic and more](https://nginx.cc/en/errors/unknown-directive): nginx -t reporting “unknown directive "http2"” and the like means this nginx does not know the directive: the version is too old (http2 on needs 1.25.1+), the module is not built in or not loaded (brotli and headers-more are third-party), or it is a typo or an invisible character. · [中文](https://nginx.cc/zh/errors/unknown-directive)
- [nginx cannot load certificate: missing file or key mismatch](https://nginx.cc/en/errors/cannot-load-certificate): nginx -t reporting “cannot load certificate … No such file or directory” most often means ssl_certificate was written before the certificate existed (chicken and egg); “key values mismatch” means the certificate and key are not a pair. · [中文](https://nginx.cc/zh/errors/cannot-load-certificate)

## CMS rewrite rules
- [WordPress nginx rewrite rules](https://nginx.cc/en/rewrite/wordpress) · [中文](https://nginx.cc/zh/rewrite/wordpress)
- [Typecho nginx rewrite rules](https://nginx.cc/en/rewrite/typecho) · [中文](https://nginx.cc/zh/rewrite/typecho)
- [Z-Blog PHP nginx rewrite rules](https://nginx.cc/en/rewrite/zblog) · [中文](https://nginx.cc/zh/rewrite/zblog)
- [emlog nginx rewrite rules](https://nginx.cc/en/rewrite/emlog) · [中文](https://nginx.cc/zh/rewrite/emlog)
- [Halo nginx rewrite rules](https://nginx.cc/en/rewrite/halo) · [中文](https://nginx.cc/zh/rewrite/halo)
- [Ghost nginx rewrite rules](https://nginx.cc/en/rewrite/ghost) · [中文](https://nginx.cc/zh/rewrite/ghost)
- [Discuz! X nginx rewrite rules](https://nginx.cc/en/rewrite/discuz) · [中文](https://nginx.cc/zh/rewrite/discuz)
- [phpBB nginx rewrite rules](https://nginx.cc/en/rewrite/phpbb) · [中文](https://nginx.cc/zh/rewrite/phpbb)
- [DedeCMS nginx rewrite rules](https://nginx.cc/en/rewrite/dedecms) · [中文](https://nginx.cc/zh/rewrite/dedecms)
- [EmpireCMS nginx rewrite rules](https://nginx.cc/en/rewrite/empirecms) · [中文](https://nginx.cc/zh/rewrite/empirecms)
- [PbootCMS nginx rewrite rules](https://nginx.cc/en/rewrite/pbootcms) · [中文](https://nginx.cc/zh/rewrite/pbootcms)
- [Drupal nginx rewrite rules](https://nginx.cc/en/rewrite/drupal) · [中文](https://nginx.cc/zh/rewrite/drupal)
- [Joomla nginx rewrite rules](https://nginx.cc/en/rewrite/joomla) · [中文](https://nginx.cc/zh/rewrite/joomla)
- [MediaWiki nginx rewrite rules](https://nginx.cc/en/rewrite/mediawiki) · [中文](https://nginx.cc/zh/rewrite/mediawiki)
- [ThinkPHP nginx rewrite rules](https://nginx.cc/en/rewrite/thinkphp) · [中文](https://nginx.cc/zh/rewrite/thinkphp)
- [Laravel nginx rewrite rules](https://nginx.cc/en/rewrite/laravel) · [中文](https://nginx.cc/zh/rewrite/laravel)
- [Magento 2 nginx rewrite rules](https://nginx.cc/en/rewrite/magento) · [中文](https://nginx.cc/zh/rewrite/magento)
- [PrestaShop nginx rewrite rules](https://nginx.cc/en/rewrite/prestashop) · [中文](https://nginx.cc/zh/rewrite/prestashop)
- [OpenCart nginx rewrite rules](https://nginx.cc/en/rewrite/opencart) · [中文](https://nginx.cc/zh/rewrite/opencart)
- [WHMCS nginx rewrite rules](https://nginx.cc/en/rewrite/whmcs) · [中文](https://nginx.cc/zh/rewrite/whmcs)
- [Nextcloud nginx rewrite rules](https://nginx.cc/en/rewrite/nextcloud) · [中文](https://nginx.cc/zh/rewrite/nextcloud)

## Policies
- [About, sources and verification](https://nginx.cc/en/about#sources)
- [Crawler and AI policy](https://nginx.cc/en/about#ai): search, AI answers and training allowed on public pages; /api/ and user reports are excluded.
- [Credits](https://nginx.cc/en/credits): generator layout adapted from nginxconfig.io (MIT, (c) 2020 DigitalOcean); TLS profiles from Mozilla Server Side TLS.

## Optional
- [Full encyclopedia text](https://nginx.cc/llms-full.txt)
- [xyz.sh](https://xyz.sh): VPS one-liner scripts & benchmarks
- [ssl.sh](https://ssl.sh): SSL certificate tools
- [114.io](https://114.io): Hosting-provider support & refund lookup
- [youhuima.cc](https://youhuima.cc): Hosting & domain coupons
