{"id":63518,"date":"2025-04-29T16:38:15","date_gmt":"2025-04-29T08:38:15","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63518\/"},"modified":"2025-04-29T16:38:15","modified_gmt":"2025-04-29T08:38:15","slug":"nginx304%e9%94%99%e8%af%af%e6%80%8e%e4%b9%88%e8%a7%a3%e5%86%b3-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63518\/","title":{"rendered":"nginx304\u9519\u8bef\u600e\u4e48\u89e3\u51b3"},"content":{"rendered":"<blockquote><p>\n  \u95ee\u9898\u7684\u7b54\u6848\uff1a304 not modified \u9519\u8bef\u8868\u793a\u6d4f\u89c8\u5668\u5df2\u7f13\u5b58\u5ba2\u6237\u7aef\u8bf7\u6c42\u7684\u6700\u65b0\u8d44\u6e90\u7248\u672c\u3002\u89e3\u51b3\u65b9\u6848\uff1a1. \u6e05\u9664\u6d4f\u89c8\u5668\u7f13\u5b58\uff1b2. \u7981\u7528\u6d4f\u89c8\u5668\u7f13\u5b58\uff1b3. \u914d\u7f6e nginx \u5141\u8bb8\u5ba2\u6237\u7aef\u7f13\u5b58\uff1b4. \u68c0\u67e5\u6587\u4ef6\u6743\u9650\uff1b5. \u68c0\u67e5\u6587\u4ef6\u54c8\u5e0c\uff1b6. \u7981\u7528 cdn \u6216\u53cd\u5411\u4ee3\u7406\u7f13\u5b58\uff1b7. \u91cd\u542f nginx\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/27\/2024052717362151941.jpg\" class=\"aligncenter\" title=\"nginx304\u9519\u8bef\u600e\u4e48\u89e3\u51b3\u63d2\u56fe\" alt=\"nginx304\u9519\u8bef\u600e\u4e48\u89e3\u51b3\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u89e3\u51b3 Nginx 304 \u9519\u8bef<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong>\u4e3a\u4ec0\u4e48\u4f1a\u51fa\u73b0 Nginx 304 \u9519\u8bef\uff1f<\/p>\n<p><strong>\u56de\u7b54\uff1a<\/strong>304 Not Modified \u9519\u8bef\u8868\u793a\u6d4f\u89c8\u5668\u7f13\u5b58\u4e2d\u5df2\u5b58\u5728\u5ba2\u6237\u7aef\u8bf7\u6c42\u7684\u8d44\u6e90\u7684\u6700\u65b0\u7248\u672c\uff0c\u56e0\u6b64\u65e0\u9700\u518d\u6b21\u4e0b\u8f7d\u8be5\u8d44\u6e90\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<p><strong>1. \u6e05\u9664\u6d4f\u89c8\u5668\u7f13\u5b58<\/strong><\/p>\n<ul>\n<li>\u5728 Chrome \u4e0a\uff1aCtrl + Shift + Del<\/li>\n<li>\u5728 Firefox \u4e0a\uff1aCtrl + Shift + Delete<\/li>\n<li>\u5728 Safari \u4e0a\uff1aCmd + Option + E<\/li>\n<li>\u5728 Edge \u4e0a\uff1aCtrl + Shift + Del<\/li>\n<\/ul>\n<p><strong>2. \u7981\u7528\u6d4f\u89c8\u5668\u7f13\u5b58<\/strong><\/p>\n<p>\u5bf9\u4e8e\u5f00\u53d1\u548c\u8c03\u8bd5\u76ee\u7684\uff0c\u53ef\u4ee5\u4e34\u65f6\u7981\u7528\u6d4f\u89c8\u5668\u7f13\u5b58\uff1a<\/p>\n<ul>\n<li>\u5728 Chrome \u4e0a\uff1a\u6309 F12 \u6253\u5f00\u5f00\u53d1\u8005\u5de5\u5177\uff0c\u7136\u540e\u8f6c\u5230\u7f51\u7edc\u9009\u9879\u5361\u5e76\u9009\u4e2d\u201c\u7981\u7528\u7f13\u5b58\u201d\u3002<\/li>\n<li>\u5728 Firefox \u4e0a\uff1a\u5728\u5730\u5740\u680f\u4e2d\u952e\u5165\u201cabout:config\u201d\uff0c\u641c\u7d22\u201cnetwork.http.use-cache\u201d\uff0c\u5e76\u5c06\u5176\u8bbe\u7f6e\u4e3a\u201cfalse\u201d\u3002<\/li>\n<\/ul>\n<p><strong>3. \u914d\u7f6e Nginx \u5141\u8bb8\u5ba2\u6237\u7aef\u7f13\u5b58<\/strong><\/p>\n<p>\u786e\u4fdd Nginx \u914d\u7f6e\u4e2d\u5141\u8bb8\u5ba2\u6237\u7aef\u7f13\u5b58\uff1a<\/p>\n<pre>location \/ {\n    expires 1d;\n    add_header Cache-Control \"public\";\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u68c0\u67e5\u6587\u4ef6\u6743\u9650<\/strong><\/p>\n<p>\u786e\u4fdd Web \u670d\u52a1\u5668\u5177\u6709\u8bfb\u53d6\u6587\u4ef6\u6240\u9700\u7684\u6743\u9650\uff1a<\/p>\n<ul>\n<li>Linux\uff1a\u4f7f\u7528 chown \u6216 chmod \u547d\u4ee4\u4fee\u6539\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u6743\u9650\u3002<\/li>\n<li>Windows\uff1a\u53f3\u952e\u5355\u51fb\u6587\u4ef6\u6216\u6587\u4ef6\u5939\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\uff0c\u7136\u540e\u4fee\u6539\u201c\u5b89\u5168\u201d\u9009\u9879\u5361\u4e2d\u7684\u6743\u9650\u3002<\/li>\n<\/ul>\n<p><strong>5. \u68c0\u67e5\u6587\u4ef6\u54c8\u5e0c<\/strong><\/p>\n<p>304 \u9519\u8bef\u4e5f\u53ef\u80fd\u662f\u7531\u4e8e\u6587\u4ef6\u54c8\u5e0c\u4e0d\u5339\u914d\u9020\u6210\u7684\u3002\u4f7f\u7528 md5sum \u6216 sha256sum \u547d\u4ee4\u68c0\u67e5\u6587\u4ef6\u54c8\u5e0c\u662f\u5426\u5339\u914d\u670d\u52a1\u5668\u4e0a\u7684\u54c8\u5e0c\u3002<\/p>\n<p><strong>6. \u7981\u7528 CDN \u6216\u53cd\u5411\u4ee3\u7406\u7f13\u5b58<\/strong><\/p>\n<p>\u5982\u679c\u4f7f\u7528 CDN \u6216\u53cd\u5411\u4ee3\u7406\uff0c\u8bf7\u68c0\u67e5\u5176\u914d\u7f6e\u662f\u5426\u7981\u7528\u7f13\u5b58\u3002<\/p>\n<p><strong>7. \u91cd\u542f Nginx<\/strong><\/p>\n<p>\u5728\u8fdb\u884c\u66f4\u6539\u540e\uff0c\u8bf7\u91cd\u542f Nginx \u4ee5\u4f7f\u66f4\u6539\u751f\u6548\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f304\u9519\u8bef\u600e\u4e48\u89e3\u51b3\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u9898\u7684\u7b54\u6848\uff1a304 not modified \u9519\u8bef\u8868\u793a\u6d4f\u89c8\u5668\u5df2\u7f13\u5b58\u5ba2\u6237\u7aef\u8bf7\u6c42\u7684\u6700\u65b0\u8d44\u6e90\u7248\u672c\u3002\u89e3\u51b3\u65b9\u6848\uff1a1. \u6e05\u9664\u6d4f\u89c8\u5668\u7f13\u5b58\uff1b2. \u7981\u7528\u6d4f\u89c8\u5668\u7f13\u5b58\uff1b3. \u914d\u7f6e nginx \u5141\u8bb8\u5ba2\u6237\u7aef\u7f13\u5b58\uff1b4. \u68c0\u67e5\u6587\u4ef6\u6743\u9650\uff1b5. \u68c0\u67e5\u6587\u4ef6\u54c8\u5e0c\uff1b6. \u7981\u7528 cdn \u6216\u53cd\u5411\u4ee3\u7406\u7f13\u5b58\uff1b7. \u91cd\u542f nginx\u3002 \u5982\u4f55\u89e3\u51b3 Nginx 304 \u9519\u8bef \u95ee\u9898\uff1a\u4e3a\u4ec0\u4e48\u4f1a\u51fa\u73b0 Nginx 304 \u9519\u8bef\uff1f \u56de\u7b54\uff1a304 Not Modified \u9519\u8bef\u8868\u793a\u6d4f\u89c8\u5668\u7f13\u5b58\u4e2d\u5df2\u5b58\u5728\u5ba2\u6237\u7aef\u8bf7\u6c42\u7684\u8d44\u6e90\u7684\u6700\u65b0\u7248\u672c\uff0c\u56e0\u6b64\u65e0\u9700\u518d\u6b21\u4e0b\u8f7d\u8be5\u8d44\u6e90\u3002 \u89e3\u51b3\u65b9\u6848\uff1a 1. \u6e05\u9664\u6d4f\u89c8\u5668\u7f13\u5b58 \u5728 Chrome \u4e0a\uff1aCtrl + Shift + Del \u5728 Firefox \u4e0a\uff1aCtrl + Shift + Delete \u5728 Safari \u4e0a\uff1aCmd + Option + E \u5728 Edge \u4e0a\uff1aCtrl [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63518","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=63518"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63518\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}