{"id":169740,"date":"2020-10-16T18:21:19","date_gmt":"2020-10-16T10:21:19","guid":{"rendered":"http:\/\/4563.org\/?p=169740"},"modified":"2020-10-16T18:21:19","modified_gmt":"2020-10-16T10:21:19","slug":"nginx-%e7%9a%84-cache-file-has-too-long-header-%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=169740","title":{"rendered":"nginx \u7684 cache file has too long header \u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  nginx \u7684 cache file has too long header \u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : kokol <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u6709\u65f6\u5728 nginx \u7684\u65e5\u5fd7\u91cc\u4f1a\u78b0\u5230\u5982\u4e0b\u7684\u65e5\u5fd7\u9519\u8bef\uff1a<\/p>\n<p>cache file &#8220;\/usr\/local\/openresty\/nginx\/cache\/c\/0c\/1eb7633e809b8306294a2a7da39c80cc&#8221; has too long header<\/p>\n<p>\u4e00\u822c\u4ec0\u4e48\u60c5\u51b5\u4e0b\uff0c\u624d\u4f1a\u51fa\u73b0\u8fd9\u4e2a\u9519\u8bef\uff0c\u6211\u7684 proxy_buffer_size \u8fd9\u4e9b\u8bbe\u7f6e\u90fd\u662f\u7528\u7684\u9ed8\u8ba4\u503c\u3002<\/p>\n<p>google \u641c\u7d22\u4e86\u4e00\u4e0b\uff0c\u770b\u5230 nginx \u7684\u6e90\u4ee3\u7801\u91cc\u6709\u5982\u4e0b\u7684\u4ee3\u7801\uff1a<br \/>https:\/\/github.com\/phusion\/nginx\/blob\/master\/src\/http\/ngx_http_file_cache.c<br \/> if (h-&gt;body_start &gt; c-&gt;body_start) {<br \/> ngx_log_error(NGX_LOG_CRIT, r-&gt;connection-&gt;log, 0,<br \/> &#8220;cache file &#8220;%s&#8221; has too long header&#8221;,<br \/> c-&gt;file.name.data);<br \/> return NGX_DECLINED;<br \/> }<\/p>\n<p>http:\/\/hg.nginx.org\/nginx\/rev\/6f97afc238de \u8fd9\u4e2a\u7f51\u7ad9\u4e5f\u6709\u76f8\u5e94\u7684\u8bf4\u660e<\/p>\n<p>\u6211\u81ea\u5df1\u4e5f\u6d4b\u8bd5\u4e86\u4e00\u4e0b\uff0cproxy_buffer_size \u8fd9\u4e9b\u8bbe\u7f6e\u90fd\u662f\u7528\u7684\u9ed8\u8ba4\u503c\uff0c\u7136\u540e\u8bf7\u6c42\u4e00\u4e2a 2M \u7684\u6587\u4ef6\uff0cproxy_cache \u7684\u6587\u4ef6\u5939\u91cc\u4e5f\u6709\u7f13\u5b58\u7684\u6587\u4ef6\uff0c\u4f46\u662f\u8bbf\u95ee\u90fd\u662f\u6b63\u5e38\u7684\uff0c\u6211\u8fd8\u662f\u65e0\u6cd5\u590d\u73b0\u8fd9\u79cd\u9519\u8bef\uff0c\u4e0d\u77e5\u9053\u4ec0\u4e48\u60c5\u51b5\u4e0b\u4f1a\u51fa\u73b0\u8fd9\u4e2a\u9519\u8bef      <\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>2<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3830865\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : geekzu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e4b\u524d\u9047\u5230\u8fc7\uff0c\u67e5\u4e86\u4e00\u5708\u5e94\u8be5\u662f cache \u6587\u4ef6\u5931\u6548 \/\u635f\u574f\u5bfc\u81f4\uff0c\u8fd9\u79cd\u72b6\u6001 nginx \u4f1a\u91cd\u65b0\u53d6\u6e90\u505a\u65b0\u7684 cache                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3830866\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : kokol <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @geekzu \u8c22\u8c22,\u6211\u7528 ab \u538b\u6d4b\u5de5\u5177\u538b\u6d4b\u4e86\u4e0b\uff0c\u6709\u4e2a\u4e0a\u5343\u5e76\u53d1\u7684\u65f6\u5019\uff0c\u5c31\u4f1a\u6709 cache file has too long header \u7684\u9519\u8bef<br \/>\u5982\u679c nginx \u54cd\u5e94\u7684 body \u6bd4\u8f83\u5927\u7684\u65f6\u5019\uff0c\u51fa\u73b0\u7684\u6982\u7387\u4e5f\u5927\u3002<\/p>\n<p>\u96be\u9053\u662f\u5728\u9ad8\u5e76\u53d1\u60c5\u51b5\u4e0b\uff0cnginx \u4ece\u540e\u7aef\u83b7\u53d6\u5230\u6587\u4ef6\u4e4b\u540e\uff0c\u653e\u5165\u4e86\u4e00\u90e8\u5206\u5230\u7f13\u5b58\u6587\u4ef6\u91cc\uff0c\u53e6\u4e00\u4e2a\u8bf7\u6c42\u8fc7\u6765\u53d1\u73b0\u6587\u4ef6\u4e0d\u5b8c\u6574\u5c31\u91cd\u65b0\u53bb\u540e\u7aef\u8bf7\u6c42                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>nginx \u7684 cache fil&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/169740"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=169740"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/169740\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=169740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=169740"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=169740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}