x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to deploy a HTML5 game on Apache?

I have packaged a game on HTML5 and it works fine when using the HTML5LauncherHelper.exe.

However I then uploaded everything to my web server and couldn't get it to work.

Sometimes I would get a 500 internal server error, probably because of a bad .htaccess file edit.

Sometimes the page would load but the game wouldn't work. It says in a red rectangle in the middle, "Uncaught Syntax Error: Unexpected token ILLEGAL", and the log stops at "downloading symbols file".

So this is overall very confusing, I have absolutely no knowledge of .htaccess files, http.conf, apache, etc. So how do I properly edit the htaccess to get it working, in a very noob language please?

By the way: the documentation seems to be very outdated: we no longer need to dowload emscriptem, python, etc. Also it needs info on how to deploy for the web.

Thanks!

Product Version: UE 4.9
Tags:
more ▼

asked Nov 11 '15 at 07:13 AM in Packaging & Deployment

avatar image

Ixiguis
1.1k 57 59 252

avatar image Samantha Sutton ♦♦ STAFF Nov 11 '15 at 09:16 PM

Hey Ixiguis,

After packaging the HTML5 project, you can simply upload the folder itself onto the website. So for example, c:\builds\VehicleAdvanced\HTML5*.* can be uploaded to your webserver, for example: to /var/www/html/name/games/VehicleAdvanced/HTML5/.

You may want to upload your project and provide the link to us.

avatar image Ixiguis Nov 11 '15 at 09:37 PM

Simply uploading the game to my webserver causes that "Unexpected token ILLEGAL" error. See here:

http://magiadosdoces.com/game/

I suppose I have to add a .htaccess file to enable gzip, as per the Readme.txt generated in the packaged folder, but I don't know what to put in place of ${SRVROOT}.

avatar image Samantha Sutton ♦♦ STAFF Nov 11 '15 at 10:20 PM

Within the SRVROOT, you should be adding the server root. Please look at this AnswerHub post for a more visual explanation.

avatar image Ixiguis Nov 11 '15 at 10:55 PM

I tried adding this to .htaccess:

 <Directory "/home/magiados/public_html/game">
    AddEncoding gzip gz
   </Directory>

I am now getting a 500 internal server error.

Also tried the following folder: /home/magiados/www.magiadosdoces.com/game

I don't really know what the folder is... All I know is that in cPanel, the initial directory says "/home/magiados" and in the FileManager, the path to the game is "public_html/game".

avatar image Samantha Sutton ♦♦ STAFF Nov 13 '15 at 02:51 PM

Please upload a screenshot of your cPanel showing your files. We simply need to know how your file structure looks.

We'd also like you to try removing the .htaccess file temporarily and see what the page looks like while it's being loaded.

Once you've gotten this information to us, the screenshot and removal of the .htaccess file, we should be able to provide you additional steps to resolve this issue.

By the way, which version of Apache are you using?

avatar image Ixiguis Nov 13 '15 at 04:54 PM

In cPanel (main window), it says:

Main doman: magiadosdoces.com

Initial directory: /home/magiados

File manager screenshot:

alt text

If I remove .htaccess I get this:

alt text

A few seconds later it changes to this:

alt text

And stays like that.

Regarding apache version... I tried several methods to discover it but nothing worked. My cPanel doesn't show server status, phpinfo is blocked by my host, and I have no root access. So I guess the only way is asking them, I opened a ticket, but it could take a while.

untitled.png (277.0 kB)
1.png (51.6 kB)
2.png (58.5 kB)
avatar image Ixiguis Nov 13 '15 at 05:08 PM

Oh, they were quick :O

It is Apache/2.4.16

avatar image Ixiguis Nov 13 '15 at 05:40 PM

Also according to my host's tech support, the path I entered in .htaccess is correct: home/magiados/public_html/game.

They also said the "zip extension" is enabled and activated on the server (maybe they meant gzip, maybe not, I don't know if there's a difference).

avatar image Samantha Sutton ♦♦ STAFF Nov 18 '15 at 04:49 PM

Thanks for providing me with this information. We will contact you as soon as we have additional information. Thank you!

avatar image Samantha Sutton ♦♦ STAFF Nov 24 '15 at 05:34 PM

Thank you for your patience.

We keep getting a server 500 error. This means that it's a server side configuration issue. We believe that it could be the .htaccess file.

However, we also noticed this:

 <Directory "/home/magiados/public_html/game">
     AddEncoding gzip gz
 </Directory>

needs to be changed to:

 <Directory "/home/magiados/public_html/game">
     AddEncoding gzip .gz
 </Directory>

Once you've made changes to the code, could you please let us know the progress you've made?

Thanks!

avatar image Ixiguis Nov 24 '15 at 05:44 PM

Hi!

Unfortunately, no progress. I changed the htaccess file and the same thing happens, server error 500.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Got it working! I had the server 500 error as well as a bunch of other ones.

Changed the .htaccess file to this;

 <files *.gz>
 AddType "text/javascript" .gz
 AddEncoding gzip .gz
 </files>

No directory required!

Courtesy of Froffs at the forums; https://forums.unrealengine.com/showthread.php?87438-html5-SimpleHTTPServer-how-to-run-another-server

more ▼

answered Nov 25 '15 at 05:12 PM

avatar image

bzxo
141 6 17 21

avatar image Ixiguis Nov 25 '15 at 05:26 PM

YESSS this is it!! Thanks!

Samantha, you know that Readme.txt that is generated on the packaged game folder? It needs to be updated with this information! :)

Also remember to update the documentation (we no longer need to download emscriptem / python).

avatar image -AI Dec 02 '15 at 02:09 PM

Thanks a lot for this!

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question