当前位置: 首页 > 面试题库 >

从上游读取响应头时,上游发送的头太大

洪昊然
2023-03-14
问题内容

我收到这些错误:

2014/05/24 11:49:06 [error] 8376#0: *54031 upstream sent too big header while reading response header from upstream, client: 107.21.193.210, server: aamjanata.com, request: “GET /the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https://aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20ht

总是一样。网址重复并以逗号分隔。无法弄清楚是什么原因造成的。有人有主意吗?

更新:另一个错误:

http request count is zero while sending response to client

这是配置。还有其他不相关的内容,但是此部分已添加/编辑

fastcgi_cache_path /var/nginx-cache levels=1:2 keys_zone=WORDPRESS:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
proxy_buffer_size   128k;
proxy_buffers   4 256k;
proxy_busy_buffers_size   256k;
    # Upstream to abstract backend connection(s) for PHP.
    upstream php {
            #this should match value of "listen" directive in php-fpm pool
            server unix:/var/run/php5-fpm.sock;
    }

然后在服务器块中:设置$ skip_cache 0;

    # POST requests and urls with a query string should always go to PHP
    if ($request_method = POST) {
            set $skip_cache 1;
    }
    if ($query_string != "") {
            set $skip_cache 1;
    }

    # Don't cache uris containing the following segments
    if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
            set $skip_cache 1;
    }

    # Don't use the cache for logged in users or recent commenters
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
            set $skip_cache 1;
    }

    location / {
            # This is cool because no php is touched for static content.
            # include the "?$args" part so non-default permalinks doesn't break when using query string
            try_files $uri $uri/ /index.php?$args;
    }


    location ~ \.php$ {
            try_files $uri /index.php;
            include fastcgi_params;
            fastcgi_pass php;
            fastcgi_read_timeout 3000;

            fastcgi_cache_bypass $skip_cache;
            fastcgi_no_cache $skip_cache;

            fastcgi_cache WORDPRESS;
            fastcgi_cache_valid  60m;
    }

    location ~ /purge(/.*) {
        fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1";
    }`

问题答案:

将以下内容添加到您的conf文件中

fastcgi_buffers 16 16k; 
fastcgi_buffer_size 32k;


 类似资料:
  • 我正在使用nginx和Firebug+FirePHP,当我试图加载页面时,我得到了一个错误: 我们在开发环境中记录了很多东西,我想这就是使用FirePHP时出现问题的原因。在这里阅读了类似的其他问题后,似乎有以下设置之一:

  • 我得到这样的错误: 关于这个问题,有可能从nginx conf文件中增加缓冲区大小,如下所示:上游发送太大的头,而从上游读取响应头 (供以后参考,fastcgi_buffer_size和fastcgi_buffers的默认大小为4K或8K,具体与平台有关)

  • 我的日志中有这样一个错误: 从上游读取响应标头时,上游发送的标头太大 我试着补充 到我的nginx.conf http块,但不起作用 我也试着添加 到我的conf文件,但我找不到任何位置~.php${ 所以我想知道我如何克服这个错误?加法 一个手工制作的php块在/etc/nginx/nginx.conf:6中给出nginx:[emerg]未知指令“location”

  • 在我的nginx日志中,我一直得到一个“上游发送的头太大,而从上游读取响应头”的错误。 首先,这是我的架构: 运行在端口8080上的nginx服务器记录此错误。 2018/07/06 11:17:29[错误]18857#18857:*39687上游从上游读取响应标头时发送的标头太大,客户端:127.0.0.1,服务器:amr.com.au,请求:“post/wp-admin/admin-ajax.

  • 我在谷歌应用引擎中使用wordpress。当我制作一个POST API时,得到一个错误:“上游发送的头太大,而从上游读取响应头”。返回502,坏网关,nginx 我在POST API中发送的数据(JSON)约为4KB。如果发送的数据低于2KB,API返回成功。 我尝试了App Engine标准和灵活的环境,但面临同样的问题。 根据此链接:上游发送太大的头,而从上游读取响应头 在App Engine

  • 我在一个flask应用程序上使用nginx+uwsgi。在nginx设置中,服务器块具有server_name*.mydomain.com;uwsgi的位置块如下所示 我有另一个测试设置,其中所有这些设置是相同的,它的工作。有什么指示吗?当我重新启动uwsgi和nginx时,app1.mydomain.com工作,直到我加载app.mydomain.com(初始加载app.mydomain.com