4. Nginx 설정 문법
Nginx 설정 파일은 크게 Simple Directive와 Block Directive 문법으로 작성할 수 있음
1. Simple Directive (간단 지시어)
- 한 줄로 끝나는 명령어
- 세미콜론(
;)으로 반드시 끝맺음
예시
nginx.conf
worker_processes 1;
pid /var/run/nginx.pid;2. Block Directive (블록 지시어)
{ ... }중괄호로 묶인 블록 구조- 내부에 여러 지시어(또는 블록) 포함 가능
예시
nginx.conf
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name example.com;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
}Last updated on