본문으로 바로 가기
kitlocal.dev

NGINX 치트시트

로컬에서 실행

100% 브라우저에서 처리됩니다. 입력과 출력이 기기 밖으로 나가지 않습니다.

NGINX 설정 지시문 및 CLI 작업: server 블록, 리버스 프록시 헤더, WebSocket, TLS, 캐싱, 압축 및 요청 속도 제한(rate limiting).

동작 원리

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`.

서바이벌 키트

가장 먼저 배워야 할 몇 가지 명령어입니다.

40개 명령어

키보드 단축키/검색창 포커스JK선택 이동C선택 항목 복사F선택 항목 북마크Esc검색 지우기

CLI Check, Reload & Logs

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

  • 기본

    Test all included nginx configuration files for syntax and path errors

    nginx -t

    사용 시점

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

    상세 분석

    -t
    Parse config and test validity without applying

    예제

    sudo nginx -t

    결과

    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.

KitLocal 도구에서 사용해 보기

2026. 11. 15.에 확인됨 · NGINX 1.26+ / mainline 기준으로 확인됨

출처: NGINX Documentation · NGINX ngx_http_proxy_module

꺾쇠괄호 안의 내용을 본인의 값으로 바꾸세요. 명령어는 공식 문서에서 가져왔으며, 예제는 명시된 버전에서 실행되었습니다.