how to increase Apache 2 uri length limit
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)
Wh开发者_StackOverflow社区at setting can I change to increase this limit?
The best answer is "don't do that". See https://boutell.com/newfaq/misc/urllength.html (link goes to Internet Archive backup) for an explanation of why.
If you need to pass that much data, use POST, not GET.
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.
Open /etc/apache2/apache2.conf
and insert under AccessFileName .htaccess
:
LimitRequestLine 1000000
LimitRequestFieldSize 1000000
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.
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
.
Increase the Apache limits for limit request line and limit request field size and save it.
Next step, Restart apache using sudo service apache2 restart
Hope, this will solve the problem.
精彩评论