on
업로드 파일의 용량 제한 변경하기(feat. ModSecurity)
업로드 파일의 용량 제한 변경하기(feat. ModSecurity)
728x90
반응형
워드프레스의 미디어 라이브러리에 파일을 업로드 하는데 계속 오류가 발생한다. 분명 php.ini에서 업로드 할 수 있는 최대 파일용량은 아래와 같이 8GB로 설정했는데....
..... post_max_size = 8192M ..... upload_max_fileseze = 8192M .....
문제는 Mod_Security였다.
apache의 error log에서 다음과 같은 오류 메시지가 보인다..
ModSecurity: Request body (Content-Length) is larger than the configured limit (13107200)
ModSecurity에서 설정된 13,107,200(bit)보다 크기 때문에 오류가 발생하는 것이다. ModSecurity의 기본값이 1.5MB정도 인 듯 하다. /etc/httpd/conf.d/mod_security.conf의 SecRequestBodyLimit 13107200 의 값을 원하는 용량으로 변경하면 해결된다.
# ModSecurity Core Rules Set configuration IncludeOptional modsecurity.d/*.conf IncludeOptional modsecurity.d/activated_rules/*.conf # Default recommended configuration SecRuleEngine On SecRequestBodyAccess On SecRule REQUEST_HEADERS:Content-Type "text/xml" \ "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=XML" SecRequestBodyLimit 68719476736 SecRequestBodyNoFilesLimit 131072 SecRequestBodyInMemoryLimit 131072 SecRequestBodyLimitAction Reject
68,719,476,736 bit는 8GB이다. 5GB 이상의 파일이 문제없이 업로드 되는 것을 확인했다....
필요한 만큼 적절히 조절하자.
728x90
반응형
from http://aegypius.tistory.com/140 by ccl(S) rewrite - 2021-08-22 12:59:05