大文件上传时出现 Apache 错误 500 (mod_security)

2024-02-18

据我所尝试,通常的解决方案都不适合我。好吧,我的问题是,每次上传“大文件”(600 KB ~)时,我都会收到 500 错误,而较小的图像则可以正常工作。所以...,即使使用这个(极端).htaccess 文件,它仍然会发生,是的,.htaccess 是活动的:

upload_max_filesize = 100M
post_max_size = 100M
memory_limit = 128M
max_input_time = 6000
max_execution_time = 6000

因此,我查看了日志并发现了这一点(只有一行,只是将其粘贴起来,以便通过行跳转轻松阅读):

[Mon Jul 27 17:09:28.<port> 2015] [:error] [pid 21423] [client <ip>]    
ModSecurity: Access denied with code 44 (phase 2). 
Match of "eq 0" against "MULTIPART_UNMATCHED_BOUNDARY" required. 
[file "/etc/httpd/conf.d/mod_security.conf"] 
[line "35"] [id "<another id>"] 
[msg "Multipart parser detected a possible unmatched boundary."] 
[hostname "<my host>"] [uri "<my script>"] [unique_id "<id (useless I think)"]

但是,现在我无法找到如何编辑 mod_security (它具有默认配置和空的activated_rules)配置以便(我认为)允许这个“大”文件上传。我在 Apache 2.4/CentOS 7 中运行 PHP 5.3。


事实上你有一个ModSecurity alert意味着您不能有空的activated_rules 文件夹,或者您以其他方式包含规则。

ModSecurity 针对此错误的已知问题 https://github.com/SpiderLabs/ModSecurity/issues/652而且它似乎很容易出现误报。

当我的规则引发太多误报时,主要建议是关闭该规则(我假设正在触发规则 200003,但根据需要替换 id):

SecRuleRemoveById 200003
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

大文件上传时出现 Apache 错误 500 (mod_security) 的相关文章

随机推荐