本文介绍了为大型URI配置Nginx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的URI很大,我正在尝试配置Nginx接受它. URI参数的长度为52000个字符,大小为52kb.我尝试不使用Nginx来访问URI,并且工作正常.

I have a large URI and I am trying to configure Nginx to accept it. The URI parameters are 52000 characters in length with a size of 52kb. I have tried accessing the URI without Nginx and it works fine.

但是当我使用Nginx时,它给了我一个错误. --- 414(请求URI太大)

But when I use Nginx it gives me an error. --- 414 (Request-URI Too Large)

我已在http块中配置了large_client_header_buffers和client_header_buffer_size,但似乎无法正常工作.

I have configured the large_client_header_buffers and client_header_buffer_size in the http block but it doesn't seem to be working.

client_header_buffer_size 5120k;
large_client_header_buffers 16 5120k;

任何帮助将不胜感激.

谢谢.

推荐答案

我找到了解决方案.问题是有多个nginx实例正在运行.这引起了冲突,这就是为什么large_client_header_buffers无法正常工作的原因.杀死所有nginx实例后,我使用以下配置重新启动了nginx:

I have found the solution. The problem was that there were multiple instances of nginx running. This was causing a conflict and that's why the large_client_header_buffers wasnt working. After killing all nginx instances I restarted nginx with the configuration:

client_header_buffer_size 64k;
large_client_header_buffers 4 64k;

此后一切都开始工作.

希望这可以帮助遇到此问题的任何人.

Hope this helps anyone facing this problem.

这篇关于为大型URI配置Nginx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 17:43