Packaged HTML5 not loading on ApacheProblem

I have created a very basic demo game in Unreal Engine 4.11.2 and have packaged it for HTML5 successfully. It works perfectly locally but I can’t seem to get it to work on Apache.

I am trying to host it using Apache on OS X for access on another machine (My network works perfectly since other pages served by Apache are loading correctly). The autogenerated webpage loads (Pause, resume, clear stored game button etc.) but the actual game doesn’t load. I have tried adding the suggested AddEncoding copied from the readme file to the httpd.conf file but it still doesn’t load. I have also tried allowing AllowOverride etc. in httpd.conf and it still doesn’t work. Any help would be greatly appreciated as I suspect it

There is a configuration problem somewhere.

I have triedforums.unrealengine.com/showthread.php?87438-html5-SimpleHTTPServer-how-to-run-another-server but it doesn’t work.HTML.

did you copy the [ .htaccess ] file that’s also in the build package folder? these files are normally “hidden” in the unix OS…

you don’t need to touch the “system level” [ http.conf ] file. you can revert any changes you’ve done there.

also, (jic) make sure the file permissions are set for “world readable” access (chmod 744 or chmod +r)

I found the .htaccess file in the build package folder and it definitely contains different gzip code as the documentation. I’m not sure where to copy it to. Does it go in the same directory as httpdconf or the directory with the packaged files on the server?

By default, httpconf has .htaccess set to “AllowOverride None”, I think it should be changed to “AllowOverride All”. However, this has just caused Internal Server Errors.

ah, OSX…

what version of OSX are your running – and what version of apache is on it?

i forgot i ran into an issue with OSX upgrading to el capitan breaking the apache web server. to fix this, follow this pretty detailed post:

http://digitalshore.io/local-web-development-environment-apache-osx-10-11-el-capitan/

if you’re an advanced apache admin, you should be able to skim that stuff pretty easily or just do a search on “os x el capitan apache broken” – you’ll find a pile of links on how to fix this.

I have the apache server working no problem, the rest of my website is loading. The only thing that is not working is the HTML5 frame, which I suspect is due to the gzip setup.

The code in the documentation

AddType “text/javascript” .gz
AddEncoding gzip .gz

doesn’t work. I tried the generated .htaccess (thanks for the tip), but combined with AllowOverride All, it seems to break the entire server.

can you give me the link to that doc you found that code? that’s not quite correct (the AddType shouldn’t be used that way - remove it).

use the generated .htaccess file as-is in the same folder along with all of your game files. yes, keep the “AllowOverride All” directive in your apache httpd.conf or user.conf file.

otherwise, you’ll have to look in apache’s log files to see what the error is. in fact, can you post the error here? see the following post on locating the error log file on your OSX:

since i’ve been meaning to see why my OSX apache wasn’t working as well, i did the following:

server failed to start

i check to see what the OSX El Capitan upgrade did to my apache configuration

$ apachectl configtest
AH00526: Syntax error on line 20 of /etc/apache2/extra/httpd-mpm.conf:
Invalid command 'LockFile', perhaps misspelled or defined by a module not included in the server configuration

i edit the file to fix the error and reload the server:

$ sudo vi /etc/apache2/extra/httpd-mpm.conf
# commented out LockFile directive (line 20)
$ sudo apachectl stop
$ sudo apachectl start

finally, have the “it works!” page.

so, i try to load the game. i now see the “Internal Server Error” page…

server error

let’s see what the web server is complaining about:

$ grep '^ErrorLog' /etc/apache2/httpd.conf
/var/log/apache2/error_log
$ tail /var/log/apache2/error_log
/Users//Sites/QAGame/HTML5/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

seems the server doesn’t like the RewriteEngine rule – let’s see why:

$ sudo vi /etc/apache2/httpd.conf
# uncomment (i.e. remove the #) on the line: LoadModule rewrite_module libexec/apache2/mod_rewrite.so
$ sudo apachectl stop
$ sudo apachectl start

looks like the OSX El Capitan upgrade disabled that for us.
re-enable the rewrite module and reload the server again.

try to load game again, still get the “Internal Server Error” error.

another server error

again, let’s see why:

$ tail /var/log/apache2/error_log
Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : /Users//Sites/EPIC/VehicleAdBP/HTML5/VehicleAdBP.html

huh, seems these options are now required when using the RewriteRule – add them to the top of the .htaccess file

Options +FollowSymLinks +SymLinksIfOwnerMatch

finally, the game loads up and runs!

reference

I have reverted the question to the original post. Please do not edit questions with gibberish as these posts can be useful to others who may be experiencing the same error. I am closing this thread as resolved and locking the comments.