{"id":28231,"date":"2024-11-24T17:18:23","date_gmt":"2024-11-24T09:18:23","guid":{"rendered":"https:\/\/fwq.ai\/blog\/28231\/"},"modified":"2024-11-24T17:18:23","modified_gmt":"2024-11-24T09:18:23","slug":"nginx-%e9%85%8d%e7%bd%ae%e5%a6%82%e4%bd%95%e5%bd%b1%e5%93%8d-css-%e6%96%87%e4%bb%b6%e7%9a%84-content-type%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/28231\/","title":{"rendered":"Nginx \u914d\u7f6e\u5982\u4f55\u5f71\u54cd CSS \u6587\u4ef6\u7684 Content-Type\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173146555517740.jpg\" class=\"aligncenter\" title=\"Nginx \u914d\u7f6e\u5982\u4f55\u5f71\u54cd CSS \u6587\u4ef6\u7684 Content-Type\uff1f\u63d2\u56fe\" alt=\"Nginx \u914d\u7f6e\u5982\u4f55\u5f71\u54cd CSS \u6587\u4ef6\u7684 Content-Type\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong> \u914d\u7f6e\u5982\u4f55\u5f71\u54cd  \u6587\u4ef6\u7684 content-type<\/strong><\/p>\n<p>\u5728\u4f7f\u7528 Nginx \u914d\u7f6e\u670d\u52a1\u5668\u65f6\uff0c\u6709\u65f6\u53ef\u80fd\u4f1a\u9047\u5230 CSS \u6587\u4ef6\u8fd4\u56de Content-Type \u4e3a text\/html \u7684\u95ee\u9898\uff0c\u8fd9\u4f1a\u59a8\u788d\u6d4f\u89c8\u5668\u6b63\u786e\u6e32\u67d3\u6837\u5f0f\u3002\u672c\u6587\u5c06\u63a2\u8ba8\u5bfc\u81f4\u6b64\u95ee\u9898\u7684\u6f5c\u5728\u539f\u56e0\u5e76\u63d0\u4f9b\u89e3\u51b3\u65b9\u6cd5\u3002<\/p>\n<p><strong>mime.types \u914d\u7f6e<\/strong><\/p>\n<p>mime.types \u6587\u4ef6\u5b9a\u4e49\u4e86\u6587\u4ef6\u6269\u5c55\u540d\u548c MIME \u7c7b\u578b\u7684\u6620\u5c04\u3002\u786e\u4fdd mime.types \u4e2d\u5305\u542b\u4ee5\u4e0b\u6761\u76ee\uff1a<\/p>\n<pre>.css    text\/css<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u8be5\u6761\u76ee\u4e0d\u5b58\u5728\u6216\u4e0d\u6b63\u786e\uff0c\u5219 Nginx \u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u8bc6\u522b CSS \u6587\u4ef6\uff0c\u5bfc\u81f4\u8fd4\u56de\u9519\u8bef\u7684 Content-Type\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>location \u5757\u914d\u7f6e<\/strong><\/p>\n<p>location \u5757\u4e2d\u7684\u914d\u7f6e\u53ef\u4ee5\u5f71\u54cd\u54cd\u5e94\u7684 Content-Type\u3002\u5728\u793a\u4f8b\u914d\u7f6e\u4e2d\uff0cfastcgi_pass \u6307\u4ee4\u5c06\u8bf7\u6c42\u8f6c\u53d1\u5230 FastCGI \u670d\u52a1\u5668\u3002\u786e\u4fdd FastCGI \u670d\u52a1\u5668\u6b63\u786e\u914d\u7f6e\u4e3a\u5904\u7406 CSS \u6587\u4ef6\u5e76\u8fd4\u56de\u6b63\u786e\u7684 Content-Type\u3002<\/p>\n<p><strong>\u670d\u52a1\u5668\u7aef\u914d\u7f6e<\/strong><\/p>\n<p>\u5982\u679c Nginx \u4f5c\u4e3a\u53cd\u5411\u4ee3\u7406\uff0c\u5219\u95ee\u9898\u53ef\u80fd\u662f\u670d\u52a1\u5668\u7aef\u914d\u7f6e\u5f15\u8d77\u7684\u3002\u68c0\u67e5\u539f\u59cb\u670d\u52a1\u5668\u662f\u5426\u6b63\u786e\u914d\u7f6e\u4e3a\u63d0\u4f9b CSS \u6587\u4ef6\u5e76\u8fd4\u56de\u6b63\u786e\u7684 Content-Type\u3002<\/p>\n<p><strong>\u6545\u969c\u6392\u9664\u63d0\u793a<\/strong><\/p>\n<ul>\n<li>\u68c0\u67e5\u670d\u52a1\u5668\u9519\u8bef\u65e5\u5fd7\u548c\u8bbf\u95ee\u65e5\u5fd7\u4ee5\u67e5\u627e\u4efb\u4f55\u76f8\u5173\u9519\u8bef\u3002<\/li>\n<li>\u5c1d\u8bd5\u76f4\u63a5\u8bbf\u95ee CSS \u6587\u4ef6\u4ee5\u786e\u5b9a\u5b83\u662f\u4ece\u670d\u52a1\u5668\u8fd4\u56de\u7684\u8fd8\u662f\u4ece Nginx \u4f20\u9012\u7684\u3002<\/li>\n<li>\u4f7f\u7528 Chrome DevTools \u6216\u7c7b\u4f3c\u5de5\u5177\u6765\u68c0\u67e5\u54cd\u5e94\u6807\u5934\u5e76\u786e\u8ba4 Content-Type\u3002<\/li>\n<li>\u4ed4\u7ec6\u5ba1\u67e5 Nginx \u914d\u7f6e\u4ee5\u6392\u9664\u4efb\u4f55\u6f5c\u5728\u7684\u9519\u8bef\u6216\u4e0d\u4e00\u81f4\u6027\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fNginx \u914d\u7f6e\u5982\u4f55\u5f71\u54cd CSS \u6587\u4ef6\u7684 Content-Type\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\u5982\u4f55\u5f71\u54cd \u6587\u4ef6\u7684 content-type \u5728\u4f7f\u7528 Nginx \u914d\u7f6e\u670d\u52a1\u5668\u65f6\uff0c\u6709\u65f6\u53ef\u80fd\u4f1a\u9047\u5230 CSS \u6587\u4ef6\u8fd4\u56de Content-Type \u4e3a text\/html \u7684\u95ee\u9898\uff0c\u8fd9\u4f1a\u59a8\u788d\u6d4f\u89c8\u5668\u6b63\u786e\u6e32\u67d3\u6837\u5f0f\u3002\u672c\u6587\u5c06\u63a2\u8ba8\u5bfc\u81f4\u6b64\u95ee\u9898\u7684\u6f5c\u5728\u539f\u56e0\u5e76\u63d0\u4f9b\u89e3\u51b3\u65b9\u6cd5\u3002 mime.types \u914d\u7f6e mime.types \u6587\u4ef6\u5b9a\u4e49\u4e86\u6587\u4ef6\u6269\u5c55\u540d\u548c MIME \u7c7b\u578b\u7684\u6620\u5c04\u3002\u786e\u4fdd mime.types \u4e2d\u5305\u542b\u4ee5\u4e0b\u6761\u76ee\uff1a .css text\/css \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u8be5\u6761\u76ee\u4e0d\u5b58\u5728\u6216\u4e0d\u6b63\u786e\uff0c\u5219 Nginx \u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u8bc6\u522b CSS \u6587\u4ef6\uff0c\u5bfc\u81f4\u8fd4\u56de\u9519\u8bef\u7684 Content-Type\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b location \u5757\u914d\u7f6e location \u5757\u4e2d\u7684\u914d\u7f6e\u53ef\u4ee5\u5f71\u54cd\u54cd\u5e94\u7684 Content-Type\u3002\u5728\u793a\u4f8b\u914d\u7f6e\u4e2d\uff0cfastcgi_pass \u6307\u4ee4\u5c06\u8bf7\u6c42\u8f6c\u53d1\u5230 FastCGI \u670d\u52a1\u5668\u3002\u786e\u4fdd FastCGI \u670d\u52a1\u5668\u6b63\u786e\u914d\u7f6e\u4e3a\u5904\u7406 CSS \u6587\u4ef6\u5e76\u8fd4\u56de\u6b63\u786e\u7684 Content-Type\u3002 \u670d\u52a1\u5668\u7aef\u914d\u7f6e \u5982\u679c Nginx \u4f5c\u4e3a\u53cd\u5411\u4ee3\u7406\uff0c\u5219\u95ee\u9898\u53ef\u80fd\u662f\u670d\u52a1\u5668\u7aef\u914d\u7f6e\u5f15\u8d77\u7684\u3002\u68c0\u67e5\u539f\u59cb\u670d\u52a1\u5668\u662f\u5426\u6b63\u786e\u914d\u7f6e\u4e3a\u63d0\u4f9b CSS \u6587\u4ef6\u5e76\u8fd4\u56de\u6b63\u786e\u7684 Content-Type\u3002 \u6545\u969c\u6392\u9664\u63d0\u793a \u68c0\u67e5\u670d\u52a1\u5668\u9519\u8bef\u65e5\u5fd7\u548c\u8bbf\u95ee\u65e5\u5fd7\u4ee5\u67e5\u627e\u4efb\u4f55\u76f8\u5173\u9519\u8bef\u3002 \u5c1d\u8bd5\u76f4\u63a5\u8bbf\u95ee CSS \u6587\u4ef6\u4ee5\u786e\u5b9a\u5b83\u662f\u4ece\u670d\u52a1\u5668\u8fd4\u56de\u7684\u8fd8\u662f\u4ece [&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-28231","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28231","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=28231"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28231\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=28231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=28231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=28231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}