{"id":5333,"date":"2021-03-11T18:02:00","date_gmt":"2021-03-11T16:02:00","guid":{"rendered":"https:\/\/unitycoder.com\/blog\/?p=5333"},"modified":"2021-03-11T18:03:27","modified_gmt":"2021-03-11T16:03:27","slug":"run-webgl-server-manually","status":"publish","type":"post","link":"https:\/\/unitycoder.com\/blog\/2021\/03\/11\/run-webgl-server-manually\/","title":{"rendered":"Run WebGL server manually"},"content":{"rendered":"\n<p>When making webgl builds, you cannot open generated <em>index.html<\/em> file directly inside the build folder (without webserver), and if you make Build &amp; Run, and then close the browser tab, you need to do build &amp; run again to view it later.<\/p>\n\n\n\n<p><strong>Run webserver from commandline:<\/strong><br><code>\"C:\/Program Files\/Unity2019_4\/Editor\/Data\/MonoBleedingEdge\/bin\/mono.exe\" \"C:\/Program Files\/Unity2019_4\/Editor\/Data\/PlaybackEngines\/WebGLSupport\/BuildTools\/SimpleWebServer.exe\" \"X:\/YourFolder\/YourProject\/Builds\" 60606<\/code><\/p>\n\n\n\n<p>* Note the port number as a parameter, other arguments are:<br><em>&#8220;SimpleWebServer.exe source_directory [port] [pid] [&lt;wasmencoding>]&#8221;<\/em><\/p>\n\n\n\n<p>** You need to run SimpleWebServer.exe through mono.exe, otherwise it returns &#8220;403 forbidden&#8221;.<\/p>\n\n\n\n<p><strong>Using <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/unitycoder\/UnityLauncherPro\" target=\"_blank\">UnityLauncherPro<\/a>:<\/strong><br>Just added experimental feature to launch webgl server from project context menu (it launches SimpleWebServer.exe)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2021\/03\/image.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"199\" height=\"127\" data-attachment-id=\"5334\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2021\/03\/11\/run-webgl-server-manually\/image-24\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2021\/03\/image.png?fit=199%2C127&amp;ssl=1\" data-orig-size=\"199,127\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2021\/03\/image.png?fit=199%2C127&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2021\/03\/image.png?resize=199%2C127&#038;ssl=1\" alt=\"\" class=\"wp-image-5334\"\/><\/a><\/figure>\n\n\n\n<p><strong>Alternatives (web servers) <\/strong>*but requires you to build webgl inside those server folders)<br>&#8211; <a rel=\"noreferrer noopener\" href=\"https:\/\/www.apachefriends.org\/index.html\" target=\"_blank\">XAMPP<\/a>, <a rel=\"noreferrer noopener\" href=\"https:\/\/portableapps.com\/apps\/development\/xampp\" target=\"_blank\">XAMPP Portable<\/a>, <a rel=\"noreferrer noopener\" href=\"https:\/\/bitnami.com\/stack\/wamp\/installer\" target=\"_blank\">WAMPP<\/a>, <a rel=\"noreferrer noopener\" href=\"https:\/\/www.howtogeek.com\/112455\/how-to-install-iis-8-on-windows-8\/\" target=\"_blank\">IIS<\/a><\/p>\n\n\n\n<p><strong>Alternatives part#2:<\/strong><br>&#8211; Use <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/icsharpcode\/ILSpy\" target=\"_blank\">ILSpy<\/a> to decompile SimpleWebServer.exe (its c#), then build it yourself in VisualStudio, now that .exe works normally without needing to run it through mono.exe (and you could customize it to do more things).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When making webgl builds, you cannot open generated index.html file directly inside the build folder (without webserver), and if you make Build &amp; Run, and then close the browser tab, you need to do build &amp; run again to view it later. Run webserver from [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5334,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1056],"tags":[655,1200,1006,320],"class_list":["post-5333","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-external-tools","tag-server","tag-simplewebserver-exe","tag-unitylauncher","tag-webgl"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2021\/03\/image.png?fit=199%2C127&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1KTaT-1o1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/5333","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/comments?post=5333"}],"version-history":[{"count":3,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/5333\/revisions"}],"predecessor-version":[{"id":5352,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/5333\/revisions\/5352"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media\/5334"}],"wp:attachment":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media?parent=5333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/categories?post=5333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/tags?post=5333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}