# [name]

If you use just procedural geometries and don't load any textures, webpages should work straight from the file system, just double-click on HTML file in a file manager and it should appear working in the browser (you'll see file:///yourFile.html in the address bar).

## Content loaded from external files

If you load models or textures from external files, due to browsers' [link:http://en.wikipedia.org/wiki/Same_origin_policy same origin policy] security restrictions, loading from a file system will fail with a security exception.

There are two ways to solve this:

1. Change security for local files in a browser. This allows you to access your page as: `file:///yourFile.html`
2. Run files from a local web server. This allows you to access your page as: `http://localhost/yourFile.html`

If you use option 1, be aware that you may open yourself to some vulnerabilities if using the same browser for a regular web surfing. You may want to create a separate browser profile / shortcut used just for local development to be safe. Let's go over each option in turn.

## Run a local server

Many programming languages have simple HTTP servers built in. They are not as full featured as production servers such as [link:https://www.apache.org/ Apache] or [link:https://nginx.org NGINX], however they should be sufficient for testing your three.js application.

### Node.js server

Node.js has a simple HTTP server package. To install:

`npm install http-server -g`

To run (from your local directory):

`http-server . -p 8000`

### Python server

If you have [link:http://python.org/ Python] installed, it should be enough to run this from a command line (from your working directory):

`//Python 2.x python -m SimpleHTTPServer //Python 3.x python -m http.server`

This will serve files from the current directory at localhost under port 8000, i.e in the address bar type:

`http://localhost:8000/`

### Ruby server

If you have Ruby installed, you can get the same result running this instead:

`ruby -r webrick -e "s = WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start"`

### PHP server

PHP also has a built-in web server, starting with php 5.4.0:

`php -S localhost:8000`

### Lighttpd

Lighttpd is a very lightweight general purpose webserver. We'll cover installing it on OSX with HomeBrew here. Unlike the other servers discussed here, lighttpd is a full fledged production ready server.

1. Install it via homebrew `brew install lighttpd`
2. Create a configuration file called lighttpd.conf in the directory where you want to run your webserver. There is a sample [link:http://redmine.lighttpd.net/projects/lighttpd/wiki/TutorialConfiguration here].
3. In the conf file, change the server.document-root to the directory you want to serve files from.
4. Start it with `lighttpd -f lighttpd.conf`
5. Navigate to http://localhost:3000/ and it will serve static files from the directory you chose.

### IIS

If you are using Microsoft IIS as web server. Please add a MIME type settings regarding .fbx externsion before loading.

`File name externsion: fbx MIME Type: text/plain`

By default, IIS blocks .fbx, .obj files downloads. You have to configure IIS to enable these kind of files can be download.

Other simple alternatives are [link:http://stackoverflow.com/q/12905426/24874 discussed here] on Stack Overflow.