{"id":2574,"date":"2022-05-08T16:06:02","date_gmt":"2022-05-08T08:06:02","guid":{"rendered":"https:\/\/1vr.cn\/?p=2574"},"modified":"2022-05-08T16:06:02","modified_gmt":"2022-05-08T08:06:02","slug":"%e9%83%a8%e7%bd%b2unity%e7%9a%84webgl%e5%88%b0centos%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/1vr.cn\/?p=2574","title":{"rendered":"\u90e8\u7f72Unity\u7684WebGL\u5230CentOS\u670d\u52a1\u5668"},"content":{"rendered":"\n<p>Unity\u8d8a\u6765\u8d8a\u597d\u4e86,\u65b0\u5efa\u9879\u76ee\u5207\u6362\u5230WebGL\u76ee\u6807\u5e73\u53f0\u540e\u4f7f\u7528\u7f3a\u7701\u8bbe\u7f6e\u7f16\u8bd1\u51fa\u7684\u6587\u4ef6\u5c31\u53ef\u4ee5\u7528\u4e8e\u670d\u52a1\u5668\u90e8\u7f72\u4e86(<a href=\"https:\/\/docs.unity.cn\/cn\/current\/Manual\/webgl-building.html\" target=\"_blank\" rel=\"noopener\">https:\/\/docs.unity.cn\/cn\/current\/Manual\/webgl-building.html<\/a>).\u8fd9\u6b21\u6211\u4f7f\u7528\u4e86Unity 2021.3.2f1 macOS\u7248,\u7f16\u8bd1\u540e\u4f1a\u6709\u5982\u4e0b\u7ed3\u6784\u7684\u6587\u4ef6:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"286\" height=\"370\" src=\"\/wp-content\/uploads\/2022\/05\/image-1.png\" alt=\"\" class=\"wp-image-2575\" srcset=\"\/wp-content\/uploads\/2022\/05\/image-1.png 286w, \/wp-content\/uploads\/2022\/05\/image-1-232x300.png 232w\" sizes=\"auto, (max-width: 286px) 100vw, 286px\" \/><\/figure>\n\n\n\n<!--more-->\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\u6709*.br\u540e\u7f00\u7684\u6587\u4ef6.\u8fd9\u662f\u56e0\u4e3a\u5728\u7f16\u8bd1WebGL\u65f6\u9ed8\u8ba4\u5f00\u542f\u4e86\u538b\u7f29\u9009\u9879,\u540e\u7f00\u4e3abr\u7684\u4e3aBrotli\u538b\u7f29\u65b9\u6cd5,\u5982\u679c\u662fgz\u540e\u7f00\u662fgzip\u538b\u7f29\u65b9\u6cd5.\u4e0a\u4f20\u81f3\u670d\u52a1\u5668,\u8bbf\u95ee\u51fa\u73b0\u4e86\u5982\u4e0b\u63d0\u793a:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"596\" height=\"402\" src=\"\/wp-content\/uploads\/2022\/05\/image-2.png\" alt=\"\" class=\"wp-image-2576\" srcset=\"\/wp-content\/uploads\/2022\/05\/image-2.png 596w, \/wp-content\/uploads\/2022\/05\/image-2-300x202.png 300w, \/wp-content\/uploads\/2022\/05\/image-2-360x242.png 360w, \/wp-content\/uploads\/2022\/05\/image-2-563x380.png 563w\" sizes=\"auto, (max-width: 596px) 100vw, 596px\" \/><\/figure>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">Unable to parse Build\/*.framework.js.br! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header &#8220;Content-Encoding: br&#8221; present. Check browser Console and Devtools Network tab to debug.<\/mark><\/p>\n\n\n\n<p>\u8fd9\u662f\u56e0\u4e3a\u670d\u52a1\u5668\u6ca1\u6709\u6b63\u786e\u8bbe\u7f6e\u54cd\u5e94\u6807\u5934\u6765\u5904\u7406\u538b\u7f29\u683c\u5f0f,\u901a\u8fc7\u76f4\u63a5\u8bbf\u95ee*.br\u6587\u4ef6\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u5982\u4e0b\u7ed3\u679c,\u8bf4\u660e\u6d4f\u89c8\u5668\u4e0d\u80fd\u6b63\u786e\u7684\u89e3\u538b\u7f29\u6587\u4ef6:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"778\" height=\"456\" src=\"\/wp-content\/uploads\/2022\/05\/image-3.png\" alt=\"\" class=\"wp-image-2577\" srcset=\"\/wp-content\/uploads\/2022\/05\/image-3.png 778w, \/wp-content\/uploads\/2022\/05\/image-3-300x176.png 300w, \/wp-content\/uploads\/2022\/05\/image-3-768x450.png 768w, \/wp-content\/uploads\/2022\/05\/image-3-648x380.png 648w\" sizes=\"auto, (max-width: 778px) 100vw, 778px\" \/><\/figure>\n\n\n\n<p>\u6709\u591a\u79cd\u89e3\u51b3\u65b9\u5f0f,\u6bd4\u5982\u5728Unity\u7684\u7f16\u8bd1\u8bbe\u7f6e\u4e2d\u7981\u7528\u538b\u7f29\u9009\u9879\u7b49\u7b49,\u7981\u7528\u538b\u7f29\u53ef\u4ee5\u53c2\u8003\u5b98\u65b9\u6587\u6863:<a rel=\"noreferrer noopener\" href=\"https:\/\/docs.unity.cn\/cn\/current\/Manual\/webgl-deploying.html\" target=\"_blank\">https:\/\/docs.unity.cn\/cn\/current\/Manual\/webgl-deploying.html<\/a>.<\/p>\n\n\n\n<p>\u6211\u7684\u670d\u52a1\u5668\u662fCentOS\u7cfb\u7edf,\u9700\u8981\u5230Apache\u7684\u914d\u7f6e\u6587\u4ef6\u8def\u5f84\u4e0b\u521b\u5efa\u5bf9br\u7b49\u6587\u4ef6\u7c7b\u578b\u6620\u5c04,\u8ba9\u6d4f\u89c8\u5668\u80fd\u6b63\u786e\u89e3\u6790\u8be5\u540e\u7f00\u7c7b\u578b.\u9ed8\u8ba4\u5728<strong>etc\/httpd\/conf.d\/<\/strong>\u6587\u4ef6\u5939\u4e0b\u6211\u4eec\u521b\u5efa\u4e00\u4e2a\u65b0\u7684*.conf\u6587\u4ef6,\u5982 <strong>vim forUnityWeb.conf<\/strong>,\u5185\u5bb9\u5982\u4e0b:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;IfModule mod_mime.c>\n\tRemoveType .br\n\tRemoveLanguage .br\n\tAddEncoding br .br\n\tAddType application\/octet-stream .data.br\n\tAddType application\/wasm .wasm.br\n\tAddType application\/javascript .js.br\n\tAddType application\/octet-stream .symbols.json.br\n&lt;\/IfModule><\/code><\/pre>\n\n\n\n<p>\u4fdd\u5b58\u8be5\u6587\u4ef6,\u6709\u5173\u5176\u5b83\u670d\u52a1\u5668\u914d\u7f6e\u53ef\u4ee5\u67e5\u770b\u5b98\u65b9\u6587\u6863(<a rel=\"noreferrer noopener\" href=\"https:\/\/docs.unity.cn\/cn\/current\/Manual\/webgl-server-configuration-code-samples.html\" target=\"_blank\">https:\/\/docs.unity.cn\/cn\/current\/Manual\/webgl-server-configuration-code-samples.html<\/a>),\u505a\u597d\u914d\u7f6e\u540e\u518d\u4f7f\u7528<strong>systemctl reload httpd<\/strong>\u547d\u4ee4\u91cd\u8f7dApache\u914d\u7f6e,\u7136\u540e\u518d\u6b21\u8bbf\u95eebr\u6587\u4ef6\u53ef\u4ee5\u770b\u5230\u6d4f\u89c8\u5668\u53ef\u4ee5\u6b63\u5e38\u89e3\u538b\u8fd9\u4e2a\u6587\u4ef6\u4e86:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"683\" height=\"439\" src=\"\/wp-content\/uploads\/2022\/05\/image-4.png\" alt=\"\" class=\"wp-image-2578\" srcset=\"\/wp-content\/uploads\/2022\/05\/image-4.png 683w, \/wp-content\/uploads\/2022\/05\/image-4-300x193.png 300w, \/wp-content\/uploads\/2022\/05\/image-4-591x380.png 591w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\" \/><\/figure>\n\n\n\n<p>\u6e05\u7a7a\u6d4f\u89c8\u5668\u7f13\u5b58\u518d\u6b21\u8bbf\u95eeWebGL\u9875\u9762\u5c31\u6ca1\u6709\u95ee\u9898\u4e86,\u597d\u4e86,\u4eca\u5929\u5c31\u5199\u5230\u8fd9\u91cc,\u56de\u89c1.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Unity\u8d8a\u6765\u8d8a\u597d\u4e86,\u65b0\u5efa\u9879\u76ee\u5207\u6362\u5230WebGL\u76ee\u6807\u5e73\u53f0\u540e\u4f7f\u7528\u7f3a\u7701\u8bbe\u7f6e\u7f16\u8bd1\u51fa\u7684\u6587\u4ef6\u5c31\u53ef\u4ee5\u7528\u4e8e\u670d\u52a1\u5668\u90e8\u7f72\u4e86(htt &hellip; <a href=\"https:\/\/1vr.cn\/?p=2574\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">\u90e8\u7f72Unity\u7684WebGL\u5230CentOS\u670d\u52a1\u5668<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[38,287,285,286],"class_list":{"0":"post-2574","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-5","7":"tag-unity","8":"tag-unity-br","9":"tag-webgl","11":"without-featured-image"},"_links":{"self":[{"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/posts\/2574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/1vr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2574"}],"version-history":[{"count":1,"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/posts\/2574\/revisions"}],"predecessor-version":[{"id":2579,"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/posts\/2574\/revisions\/2579"}],"wp:attachment":[{"href":"https:\/\/1vr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/1vr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/1vr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}