3. Nginx 설정 파일 확인하기
Nginx가 /nginx/html 경로에 저장된 index.html 파일을 클라이언트에게 제공하기 위해서는 Nginx가 해당 경로에 대한 정보를 알고 있어야 함
Nginx는 설정 파일을 통해 해당 정보를 인식하고 동작할 수 있도록 구성되어 있음
따라서 개발자는 Nginx의 서버 로직을 직접 수정하지 않고, 설정 파일만 변경하면 서버의 동작과 구성을 변경할 수 있음
1. Nginx의 동작과 구성을 결정하는 설정 파일 확인하기
설정 파일은 .conf로 끝나는 이름의 파일로 작성되어 있음
Nginx의 기본 설정 파일이 위치한 경로로 이동
terminal
# 현재경로: C:\nginx
cd conf/etc/nginx 경로 내 파일 목록 조회
terminal
ls→ 다음의 목록들이 조회됨
fastcgi.conf koi-utf mime.types nginx.conf.backup uwsgi_params
fastcgi_params koi-win nginx.conf scgi_params win-utf
nginx.conf 파일의 내용 조회
terminal
cat nginx.conf실행 결과
nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
# ...중간 부분을 확인하면 server로 시작하는 디렉티브가 있음
nginx.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html; # html파일이 위치한 경로는 html 폴더 내부라고 지정
index index.html index.htm; # 응답할 html 파일명
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}→ root html;
index index.html index.htm; 부분을 통해 index.html 파일이 서빙되고 있는 것을 유추할 수 있음
Last updated on