Skip to Content
Suffering builds character
아카이브8.Nginx특징로깅1. Nginx 로깅

1. Nginx 로깅

Nginx는 Nginx 웹 서버로의 모든 클라이언트의 요청에 대해 로그를 남김

로그가 적재된 파일은 logs/ 경로에 저장되어 있음

terminal
# 현재경로: C:\nginx ls logs # 실행 결과 - access.log error.log

기존에 적재된 로그 파일의 내용 초기화

terminal
echo '' > access.log echo '' > error.log

이후 루트 페이지로 접근하여 로깅이 처리되었는지 확인하기 위해 요청 전송

terminal
curl localhost

접근 로그 확인

terminal
cat access.log 127.0.0.1 - - [16/Jul/2025:21:48:28 +0900] "GET / HTTP/1.1" 200 403 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36" 127.0.0.1 - - [16/Jul/2025:21:48:28 +0900] "GET /style.css HTTP/1.1" 200 527 "http://localhost/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"

존재하지 않는 페이지로 접근

terminal
curl localhost/nothing

에러 로그 확인

terminal
cat error.log 2025/07/16 21:50:11 [error] 14112#13656: *4 CreateFile() "C:\nginx/nginx-practice/nothing" failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: "GET /nothing HTTP/1.1", host: "localhost"
Last updated on