FireDrago

[bobzip] nginx Request Entity Too Large 오류 본문

프로젝트

[bobzip] nginx Request Entity Too Large 오류

화이용 2024. 8. 2. 13:28

서비스 배포하여 레시피 업로드를 하는데 위와같은 오류가 발생했다.

 

nginx를 reverse proxy를 사용할때, request 요청의 사이즈를 제한할 수 있다.

 

특히나 multipartfile 등을 이용하여 이미지등을 업로드 할때, 조심해야 한다.

 

nginx.conf 파일에서 client_max_body_size 설정을 통해 사이즈를 설정 할 수 있다.

http, server, location에 설정이 가능하다.

http {
       client_max_body_size 5M;
... }

 

제한을 두지 않으려면 0 으로 설정해주면 된다.

 

$ sudo service nginx reload

nginx.conf를 설정한 뒤에는 재시작 해주자