워드프레스의 미디어 라이브러리에 파일을 업로드 하는데 계속 오류가 발생한다. 분명 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(byte)보다 크기 때문에 오류가 발생하는 것이다. ModSecurity의 기본값이 12.5MB정도 인 듯 하다. /etc/httpd/conf.d/mod_security.conf의 SecRequestBodyLimit 13107200 의 값을 원하는 용량으로 변경하면 해결된다.
<IfModule mod_security2.c>
# 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 8589934560
SecRequestBodyNoFilesLimit 131072
SecRequestBodyInMemoryLimit 131072
SecRequestBodyLimitAction Reject
8,589,934,560 byte는 8GB이다. 5GB 이상의 파일이 문제없이 업로드 되는 것을 확인했다....
필요한 만큼 적절히 조절하자.
* [2021-12-24 수정]
mod security의 데이터 단위는 byte인데 bit로 착각해서 수정했다. apache의 LimitRequestBody 등의 지시문도 기본 단위는 byte이다.
Mod Security 관련글
2021.12.24 - [Linux/Web Server] - 413 Request Entity Too Large [modsecurity & apache]
413 Request Entity Too Large [modsecurity & apache]
서버오류..... 서버에 파일을 업로드 할 때 발생했다면 대게는 업로드 할 수 있는 파일 용량의 한계를 넘겼기 때문이겠지만 워드프레스로 사이트를 제작하는 도중에 '저장하기'나 '업데이트'를
aegypius.tistory.com
2021.12.10 - [Linux/TIP] - 악성bot 차단하기 (feat. mj12bot.com/majestic12)
악성bot 차단하기 (feat. mj12bot.com/majestic12)
가끔 apache의 log를 보면 눈에 띄는 녀석이 있다. MJ12bot과 SemrushBot이다. 대충 웹 검색을 해보니 semrush는 robots.txt도 무시하고 접근한다고 하는데....robots.txt를 이용해서 사이트별로 특정 봇에 대한..
aegypius.tistory.com
2021.08.22 - [Linux/Web Server] - 업로드 파일의 용량 제한 변경하기(feat. ModSecurity)
업로드 파일의 용량 제한 변경하기(feat. ModSecurity)
워드프레스의 미디어 라이브러리에 파일을 업로드 하는데 계속 오류가 발생한다. 분명 php.ini에서 업로드 할 수 있는 최대 파일용량은 아래와 같이 8GB로 설정했는데.... ..... post_max_size = 8192M .....
aegypius.tistory.com
ModSecurity: Access denied with code 44 (phase 2). Match of "eq 0" against "MULTIPART_UNMATCHED_BOUNDARY"
워드프레스로 만든 웹사이트의 게시판에 사진을 업로드 하는 중에 발생했다. Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete you..
aegypius.tistory.com
2021.04.21 - [Linux/Web Server] - 웹 서버의 정보 숨기기 (apache)
웹 서버의 정보 숨기기 (apache)
웹서버보안 : hide apache webserver information & mod_security curl, nc, httprint 등으로 서버의 정보를 수집하는 방법은 다양하다. 도메인이나 ip주소를 입력하면 해당 서버의 OS, 웹서버, 네임서버 등의 정..
aegypius.tistory.com
'Linux > Web Server' 카테고리의 다른 글
413 Request Entity Too Large [modsecurity & apache] (0) | 2021.12.24 |
---|---|
ModSecurity: Access denied with code 44 (phase 2). Match of "eq 0" against "MULTIPART_UNMATCHED_BOUNDARY" (0) | 2021.06.25 |
apache - HTTP 30x [URL Redirection] (0) | 2021.06.07 |
웹 서버의 정보 숨기기 (apache) (2) | 2021.04.21 |
[CentOS8] httpd[proxy_fcgi:error] [pid 31nn:tid 14nn] ~ AH01071: Got error 'Primary script unknown' (0) | 2020.12.13 |
댓글