1강 - Context Logic
NGINX 기본 명령어
nginx -v
: NGINX 버전 확인nginx -t
: configuration syntax 검사 (테스트, 보통 push 전에 사용)nginx -T
: 인스턴스의 현재 configuration 확인nginx -s reload
: configuration 파일을 인스턴스로 push
-t, -T는 sudo 권한이 필요합니다.
Configuration 파일 위치
- main configuration 파일 경로:
/etc/nginx/nginx.conf
- include(커스텀 로직) 경로:
/etc/nginx/conf.d/*.conf
Context 구조 및 설명
configuration = context + directives
각 configuration은 한 개의 Main, HTTP context를 가집니다.
Context 구조 개요
- Main
- Events
- HTTP
- Server
- Location
- Upstream
- Server
- Stream
- Server
- Upstream
0️⃣ Main
최상위 레벨 directive로 구성됨
- worker 프로세스 수
- 리눅스 사용자명
- PID
- 로그 파일 위치
1️⃣ Events
- worker 프로세스에 할당된 연결 개수
1️⃣ HTTP
HTTP context에서 사용되는 directive는 자식 context(ex.Server, Upstream, Location)에 상속됨
- NGINX가 http, https 연결을 처리하는 방법을 정의
- 백엔드 서버/어플리케이션 pool 설정
1️⃣ Stream
NGINX가 3, 4계층 트래픽을 처리하는 방법을 정의
- TCP
- UDP