how to increase Apache 2 uri length limit

旧巷老猫 提交于 2019-12-29 05:07:08

问题


I am getting this error in my apache2 log:

[Tue Apr 06 09:00:56 2010] [error] [client A.B.C.D] request failed: URI too long (longer than 8190)

What setting can I change to increase this limit?


回答1:


You would have to set DEFAULT_LIMIT_REQUEST_LINE constant inside of the Apache source code, and recompile Apache. This constant is in the httpd.h header file.

After this is done you can decrease request limit using the LimitRequestLine directive.

See the http://httpd.apache.org/docs/2.0/mod/core.html#limitrequestline for more info.




回答2:


The best answer is "don't do that". See http://www.boutell.com/newfaq/misc/urllength.html for an explanation of why.

If you need to pass that much data, use POST, not GET.




回答3:


A quick hack to get it working you just edit the apache2.conf file and add the line:

LimitRequestLine 100000

Restart apache and you are all good. Although you should change the code to use POST instead of GET and remove the line as soon as you can.




回答4:


Open /etc/apache2/apache2.conf

and insert under AccessFileName .htaccess:

LimitRequestLine 1000000
LimitRequestFieldSize 1000000



回答5:


Increase the Apache limits for limit request line and limit request field size and save it.

Next step, Restart apache using sudo service apache restart

Hope, this will solve the problem.




回答6:


I you use virtual hosts with Apache, you have to set LimitRequestLine and LimitRequestFieldSize within the first virtual host definition with a matching port. For Ubuntu/Debian this is in /etc/apache2/sites-available/000-default.conf.

It doesn't work if you set these parameters in /etc/apache2/apache2.conf.



来源:https://stackoverflow.com/questions/2586339/how-to-increase-apache-2-uri-length-limit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!