Talking about HTML5, Javascript and Phaser.
We all know we need a local web server if we want to test and run HTML5 games made with Phaser.
Due to browser security policies, using a browser you can’t access files which are stored here and there in your local file system using file:/
/ protocol, it would be too dangerous.
To use the required protocol, which is http://
, you need either to upload your files to the web or to use a web server. To set up my web server environment, I always used WAMP and MAMP respectively on my Windows and macOS computers, but today I am showing you a better service which comes at no cost.
I am talking about Fenix Web Server, a web server with a clean interface and without all unnecessary stuff like Apache and MySQL which in most cases you won’t need.
And it works both on Windows and macOS.
Let’s see how to create a local web server with Fenix Web Server in 10 easy steps:
First, download it from the official page.
Run the app, and you will see this small window saying there are no servers available.
Click on Web Servers
and then New
to start the creation of a new web server
Give your server a name and a path, a free port will be chosen for you. I am creating the web server on the path where I stored my String Avoider prototype, which previously was running under WAMP as you can imagine from the path. Then click on Create
button
Now your web server is listed in the program window, you can create how many web servers you want, but at the moment it’s turned off.
Move the mouse over the server label to show a set of icons, then select the “play” icon named as Start Server
.
You will see a thumbnail of your page and the green line to the right to tell you the server is up and running.
Move the mouse over server name and click to open the page under the web server
… and here it is!! Do you remember the prototype I made for the post “String Avoider” HTML5 game prototype now featuring levels and better graphics with a gradient background? Here it is up and running on my computer.
And this is how directory content is displayed in case you don’t have an index file. Clean and simple.
Fenix Web Server will definitively be the web server I am choosing for my HTML5 projects.
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.