
이미지가 많이 들어가는 기능을 넣다 보니 413 Request Entity Too Large 에러가 발생했다.
<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.24.0 (Ubuntu)</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
nginx 서버가 받을 수 있는 클라이언트 요청 용량을 넘어 에러 발생
nginx 서버의 클라인트 요청 최대 허용 용량 늘리기
nginx 설정 파일에 들어가기
cd /etc/nginx/sites-enabled
sudo vim default
아래 내용 넣기
server {
# ... your existing configuration ...
# 클라인트 요청 최대 허용 용량
client_max_body_size 10M; # Allows up to 10MB requests
# 선택사항
client_body_timeout 120s;
client_header_timeout 120s;
send_timeout 120s;
}
🔧 Nginx client_max_body_size 설정의 일반적인 값
• 기본값: 1m (1메가바이트)
• 작은 업로드용: 5m (5메가바이트)
• 중간 크기 업로드용: 10m (10메가바이트)
• 큰 업로드용: 50m 또는 100m
• 제한 없음: 0 (※ 보안상 권장하지 않음)
⏳ client_body_timeout
• 기본값: 60초
• 목적: 클라이언트가 요청 본문(request body)을 전송할 때, Nginx가 기다릴 수 있는 최대 시간
• 적용 대상: POST, PUT 요청 등 본문이 있는 요청
⏳ client_header_timeout
• 기본값: 60초
• 목적: 클라이언트가 요청 헤더를 전송할 때, Nginx가 기다릴 수 있는 최대 시간
• 적용 대상: 모든 HTTP 요청의 헤더 읽기 단계
⏳ send_timeout
• 기본값: 60초
• 목적: 응답을 클라이언트로 전송할 때, 두 번의 쓰기(write) 작업 사이에 기다릴 수 있는 최대 시간
• 적용 대상: 클라이언트에게 응답을 전송하는 모든 상황
정말 친절한 에러 응답 덕분에 너무 쉽게 해결 방법을 찾았다.
역시 에러 응답은 친절해야 하구나를 느낀 에러
나도 좋은 에러 응답을 작성하기 위해 노력해야지