简体   繁体   English

请求实体太大的apache

[英]Request Entity Too Large apache

I have 8000 checkboxes in a form being submitted. 我在提交的表单中有8000个复选框。 No comments on how bad that is please. 没有评论请问有多糟糕。

My .htaccess 我的.htaccess

php_value post_max_size 20M
php_value max_input_vars 10000
php_value suhosin.get.max_vars 10000
php_value suhosin.post.max_vars 10000
php_value suhosin.request.max_vars 10000

I am getting the Request Entity Too Large error when I submit the form. 我提交表单时收到Request Entity Too Large错误。

When I had 3000 checkboxes it was working fine. 当我有3000个复选框时它工作正常。 Am I missing some more settings or do I need restart a service other than apache? 我是否缺少更多设置或者我是否需要重新启动除apache以外的服务?

Aside: I checked my post size using 旁白:我使用了检查我的帖子大小

 postsize = $("form").not("[type='file']").serialize().length;

The result is postsize == 165655 结果是postsize == 165655

After looking in the right log files see comments in OP, I discovered modsecurity was denying the post request and googling helped me find this solution. 在查看正确的日志文件后,请参阅OP中的注释,我发现modsecurity拒绝发布请求,谷歌搜索帮助我找到了这个解决方案。

Increase the size allowance by adding the following to the site configuration ie etc/apache2/sites-available/[your_site.conf] 通过在站点配置中添加以下内容来增加大小限额,即etc/apache2/sites-available/[your_site.conf]

<IfModule mod_security2.c>
    SecRequestBodyNoFilesLimit 5242880
</IfModule>

I used an arbitrary large number but you can use whatever number you feel comfortable with...you increase exposure/severity of DOS attacks along with the size. 我使用了一个任意大的数字但你可以使用任何你觉得舒服的数字......你会增加DOS攻击的暴露/严重程度以及大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM