Linux

[Nginx 업로드 오류] Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)

noddu 2023. 1. 25. 12:29
728x90
반응형

 

 

오류 발생

Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)

nginx의 기본 업로드 크기가 요청보낸 업로드 용량보다 적은 경우입니다

 

vi /etc/nginx/nginx.conf

nginx.conf인 설정파일을 에디터로 열고

(권한 오류가 있으면 명령어 앞에 sudo를 입력해줍니다)

 

 

반응형

 

해결
http {
    client_max_body_size 10M;
    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 4096;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

client_max_body_size 뒤에 10M; 부분을 변경합니다

client_max_body_size 자체가 작성되지 않았다면 작성해주고

:wq로 저장 후 에디터를 종료합니다

 

 

nginx -t

테스트 명령어를 입력해서 successful이 출력돼 문법적 오류가 없는지 확인합니다

 

 

systemctl restart nginx

정상적으로 저장이 됐으면 nginx를 재시작 합니다

(권한 오류가 있으면 명령어 앞에 sudo를 입력해줍니다)

반응형