Ir para o conteúdo principal
kitlocal.dev

Cheatsheet do NGINX

Roda localmente

100% processado no seu navegador. Entradas e saídas nunca saem do seu dispositivo.

Diretivas de configuração e operações CLI do NGINX: blocos server, cabeçalhos de proxy reverso, WebSockets, TLS, cache, compressão e limitação de taxa.

Como funciona

NGINX resolves `server { listen; server_name; }` first, then picks the most specific `location` block, forwarding or serving static files; always validate with `nginx -t` before `reload`.

Kit de sobrevivência

Os principais comandos para aprender primeiro.

40 comandos

Atalhos de teclado/Focar buscaJKMover seleçãoCCopiar selecionadoFFavoritar selecionadoEscLimpar busca

CLI Check, Reload & Logs

Validate syntax, reload without dropping connections, and inspect runtime config.

  • Essencial

    Test all included nginx configuration files for syntax and path errors

    nginx -t

    Quando usar

    Never reload NGINX without testing first; broken config aborts reload safely only if checked.

    Detalhamento

    -t
    Parse config and test validity without applying

    Exemplo

    sudo nginx -t

    Resultado

    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful

Server Blocks, Locations & Static Files

Understand location matching precedence, SPA fallbacks, and clean redirects.

Reverse Proxy, Upstreams & WebSockets

Forward client IPs, HTTP/1.1 keepalives, WebSocket upgrades, and timeouts.

TLS, Security Headers & Rate Limits

Enforce HTTPS, TLS 1.2/1.3, security headers, and per-IP rate/size caps.

Compression, Caching & Tuning

Enable gzip, cache-control headers, worker limits, and proxy microcaching.

Experimente em uma ferramenta do KitLocal

Verificado em 15 de nov. de 2026 · Verificado na versão NGINX 1.26+ / mainline

Fontes: NGINX Documentation · NGINX ngx_http_proxy_module

Substitua qualquer item entre colchetes angulares pelos seus próprios valores. Os comandos vêm da documentação oficial e os exemplos foram executados na versão indicada.