{"id":28320,"date":"2024-11-24T14:16:43","date_gmt":"2024-11-24T06:16:43","guid":{"rendered":"https:\/\/fwq.ai\/blog\/28320\/"},"modified":"2024-11-24T14:16:43","modified_gmt":"2024-11-24T06:16:43","slug":"nginx-%e9%85%8d%e7%bd%ae%e5%af%bc%e8%87%b4-css-%e6%96%87%e4%bb%b6-content-type-%e9%94%99%e8%af%af%ef%bc%9a%e5%a6%82%e4%bd%95%e6%8e%92%e6%9f%a5%e5%92%8c%e8%a7%a3%e5%86%b3%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/28320\/","title":{"rendered":"Nginx \u914d\u7f6e\u5bfc\u81f4 CSS \u6587\u4ef6 Content-Type \u9519\u8bef\uff1a\u5982\u4f55\u6392\u67e5\u548c\u89e3\u51b3\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173154692383293.jpg\" class=\"aligncenter\" title=\"Nginx \u914d\u7f6e\u5bfc\u81f4 CSS \u6587\u4ef6 Content-Type \u9519\u8bef\uff1a\u5982\u4f55\u6392\u67e5\u548c\u89e3\u51b3\uff1f\u63d2\u56fe\" alt=\"Nginx \u914d\u7f6e\u5bfc\u81f4 CSS \u6587\u4ef6 Content-Type \u9519\u8bef\uff1a\u5982\u4f55\u6392\u67e5\u548c\u89e3\u51b3\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong> \u914d\u7f6e\u95ee\u9898\u5bfc\u81f4  \u6587\u4ef6 content-type \u9519\u8bef<\/strong><\/p>\n<p>\u5f53\u4f7f\u7528 Nginx \u670d\u52a1\u5668\u65f6\uff0c\u8bf7\u6c42\u7684 CSS \u6587\u4ef6\u8fd4\u56de\u4e86\u9519\u8bef\u7684 Content-Type \u4e3a text\/html\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6837\u5f0f\u6e32\u67d3\u95ee\u9898\u3002\u672c\u6587\u65e8\u5728\u63a2\u8ba8\u9020\u6210\u6b64\u95ee\u9898\u7684\u6f5c\u5728\u539f\u56e0\u5e76\u63d0\u4f9b\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<p><strong>\u95ee\u9898\u539f\u56e0\u5206\u6790<\/strong><\/p>\n<p>\u6839\u636e\u63d0\u4f9b\u7684\u914d\u7f6e\u4fe1\u606f\uff0c\u95ee\u9898\u53ef\u80fd\u662f\u7531\u4e8e\u4ee5\u4e0b\u539f\u56e0\u5f15\u8d77\u7684\uff1a<\/p>\n<ul>\n<li> <strong>404 \u9519\u8bef\uff1a<\/strong>\u5982\u679c\u670d\u52a1\u5668\u65e0\u6cd5\u627e\u5230\u8bf7\u6c42\u7684 CSS \u6587\u4ef6\uff0c\u5b83\u53ef\u80fd\u4f1a\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u9875\u9762\uff0c\u8be5\u9875\u9762\u5177\u6709 text\/html Content-Type\u3002<\/li>\n<li> <strong>\u53cd\u5411\u4ee3\u7406\u914d\u7f6e\u95ee\u9898\uff1a<\/strong>\u5982\u679c Nginx \u7528\u4e8e\u53cd\u5411\u4ee3\u7406\u53e6\u4e00\u53f0\u670d\u52a1\u5668\uff0c\u95ee\u9898\u53ef\u80fd\u662f\u7531\u539f\u670d\u52a1\u5668\u8fd4\u56de\u9519\u8bef\u7684 Content-Type \u5bfc\u81f4\u7684\u3002<\/li>\n<\/ul>\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u89e3\u51b3\u6b64\u95ee\u9898\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li> <strong>\u68c0\u67e5 404 \u9519\u8bef:<\/strong> \u786e\u4fdd\u6240\u8bf7\u6c42\u7684 CSS \u6587\u4ef6\u786e\u5b9e\u5b58\u5728\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u53ef\u4ee5\u8bbf\u95ee\u3002<\/li>\n<li> <strong>\u68c0\u67e5\u53cd\u5411\u4ee3\u7406\u914d\u7f6e:<\/strong> \u5982\u679c\u4f7f\u7528\u53cd\u5411\u4ee3\u7406\uff0c\u8bf7\u68c0\u67e5\u539f\u670d\u52a1\u5668\u662f\u5426\u6b63\u786e\u914d\u7f6e\u4e3a\u8fd4\u56de\u6b63\u786e\u7684 Content-Type\u3002<\/li>\n<li> <strong>\u9a8c\u8bc1 Nginx \u914d\u7f6e:<\/strong> \u786e\u4fdd Nginx \u914d\u7f6e\u4e2d mime.types \u6587\u4ef6\u5df2\u6b63\u786e\u5305\u542b\uff0c\u5e76\u4e14\u6ca1\u6709\u8986\u76d6\u9ed8\u8ba4\u7684 Content-Type \u8bbe\u7f6e\u3002<\/li>\n<li> <strong>\u6e05\u9664\u6d4f\u89c8\u5668\u7f13\u5b58:<\/strong> \u6709\u65f6\u6d4f\u89c8\u5668\u7f13\u5b58\u53ef\u80fd\u4f1a\u5bfc\u81f4\u52a0\u8f7d\u9519\u8bef\u7684 Content-Type\u3002\u5c1d\u8bd5\u6e05\u9664\u6d4f\u89c8\u5668\u7f13\u5b58\u5e76\u91cd\u8bd5\u3002<\/li>\n<\/ol>\n<p><strong>\u5176\u4ed6\u5efa\u8bae<\/strong><\/p>\n<ul>\n<li> <strong>\u903b\u8f91\u5206\u6790:<\/strong> \u907f\u514d\u5c1d\u8bd5\u201c\u540c\u7c7b\u95ee\u9898\u89e3\u51b3\u65b9\u6848\u201d\u3002\u76f8\u53cd\uff0c\u4ece\u903b\u8f91\u89d2\u5ea6\u63a8\u5bfc\u95ee\u9898\u75c7\u7ed3\uff0c\u5e76\u4ece\u90a3\u91cc\u5f00\u59cb\u89e3\u51b3\u95ee\u9898\u3002<\/li>\n<li> <strong>\u68c0\u67e5\u9519\u8bef\u65e5\u5fd7\u548c\u8bbf\u95ee\u65e5\u5fd7:<\/strong> \u67e5\u770b Nginx \u9519\u8bef\u65e5\u5fd7\u548c\u8bbf\u95ee\u65e5\u5fd7\u4ee5\u83b7\u53d6\u6709\u5173\u9519\u8bef\u7684\u66f4\u591a\u4fe1\u606f\u3002<\/li>\n<li> <strong>\u66f4\u65b0 Nginx:<\/strong> \u5982\u679c\u68c0\u67e5\u4e0a\u8ff0\u56e0\u7d20\u540e\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u66f4\u65b0 Nginx \u7248\u672c\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fNginx \u914d\u7f6e\u5bfc\u81f4 CSS \u6587\u4ef6 Content-Type \u9519\u8bef\uff1a\u5982\u4f55\u6392\u67e5\u548c\u89e3\u51b3\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u914d\u7f6e\u95ee\u9898\u5bfc\u81f4 \u6587\u4ef6 content-type \u9519\u8bef \u5f53\u4f7f\u7528 Nginx \u670d\u52a1\u5668\u65f6\uff0c\u8bf7\u6c42\u7684 CSS \u6587\u4ef6\u8fd4\u56de\u4e86\u9519\u8bef\u7684 Content-Type \u4e3a text\/html\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6837\u5f0f\u6e32\u67d3\u95ee\u9898\u3002\u672c\u6587\u65e8\u5728\u63a2\u8ba8\u9020\u6210\u6b64\u95ee\u9898\u7684\u6f5c\u5728\u539f\u56e0\u5e76\u63d0\u4f9b\u89e3\u51b3\u65b9\u6848\u3002 \u95ee\u9898\u539f\u56e0\u5206\u6790 \u6839\u636e\u63d0\u4f9b\u7684\u914d\u7f6e\u4fe1\u606f\uff0c\u95ee\u9898\u53ef\u80fd\u662f\u7531\u4e8e\u4ee5\u4e0b\u539f\u56e0\u5f15\u8d77\u7684\uff1a 404 \u9519\u8bef\uff1a\u5982\u679c\u670d\u52a1\u5668\u65e0\u6cd5\u627e\u5230\u8bf7\u6c42\u7684 CSS \u6587\u4ef6\uff0c\u5b83\u53ef\u80fd\u4f1a\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u9875\u9762\uff0c\u8be5\u9875\u9762\u5177\u6709 text\/html Content-Type\u3002 \u53cd\u5411\u4ee3\u7406\u914d\u7f6e\u95ee\u9898\uff1a\u5982\u679c Nginx \u7528\u4e8e\u53cd\u5411\u4ee3\u7406\u53e6\u4e00\u53f0\u670d\u52a1\u5668\uff0c\u95ee\u9898\u53ef\u80fd\u662f\u7531\u539f\u670d\u52a1\u5668\u8fd4\u56de\u9519\u8bef\u7684 Content-Type \u5bfc\u81f4\u7684\u3002 \u89e3\u51b3\u65b9\u6848 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u89e3\u51b3\u6b64\u95ee\u9898\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a \u68c0\u67e5 404 \u9519\u8bef: \u786e\u4fdd\u6240\u8bf7\u6c42\u7684 CSS \u6587\u4ef6\u786e\u5b9e\u5b58\u5728\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u53ef\u4ee5\u8bbf\u95ee\u3002 \u68c0\u67e5\u53cd\u5411\u4ee3\u7406\u914d\u7f6e: \u5982\u679c\u4f7f\u7528\u53cd\u5411\u4ee3\u7406\uff0c\u8bf7\u68c0\u67e5\u539f\u670d\u52a1\u5668\u662f\u5426\u6b63\u786e\u914d\u7f6e\u4e3a\u8fd4\u56de\u6b63\u786e\u7684 Content-Type\u3002 \u9a8c\u8bc1 Nginx \u914d\u7f6e: \u786e\u4fdd Nginx \u914d\u7f6e\u4e2d mime.types \u6587\u4ef6\u5df2\u6b63\u786e\u5305\u542b\uff0c\u5e76\u4e14\u6ca1\u6709\u8986\u76d6\u9ed8\u8ba4\u7684 Content-Type \u8bbe\u7f6e\u3002 \u6e05\u9664\u6d4f\u89c8\u5668\u7f13\u5b58: \u6709\u65f6\u6d4f\u89c8\u5668\u7f13\u5b58\u53ef\u80fd\u4f1a\u5bfc\u81f4\u52a0\u8f7d\u9519\u8bef\u7684 Content-Type\u3002\u5c1d\u8bd5\u6e05\u9664\u6d4f\u89c8\u5668\u7f13\u5b58\u5e76\u91cd\u8bd5\u3002 \u5176\u4ed6\u5efa\u8bae \u903b\u8f91\u5206\u6790: \u907f\u514d\u5c1d\u8bd5\u201c\u540c\u7c7b\u95ee\u9898\u89e3\u51b3\u65b9\u6848\u201d\u3002\u76f8\u53cd\uff0c\u4ece\u903b\u8f91\u89d2\u5ea6\u63a8\u5bfc\u95ee\u9898\u75c7\u7ed3\uff0c\u5e76\u4ece\u90a3\u91cc\u5f00\u59cb\u89e3\u51b3\u95ee\u9898\u3002 \u68c0\u67e5\u9519\u8bef\u65e5\u5fd7\u548c\u8bbf\u95ee\u65e5\u5fd7: \u67e5\u770b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-28320","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28320","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=28320"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28320\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=28320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=28320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=28320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}