Starting a simple HTTP server


Did you know you can start a web server using some of your favorite languages? It’s easy!

Feel free to create a directory with a basic HTML file before diving in:

$ mkdir web
$ cd web
$ echo "Hello world" > index.html

Python

$ python -m SimpleHTTPServer

# view your files
$ open http://localhost:8000

Node.js

$ npm install -g http-server
$ http-server

# view your files
$ open http://localhost:8080

Ruby

$ ruby -run -e httpd . -p 8000

# view your files
$ open http://localhost:8000

PHP

$ php -S localhost:8000

# view your files
$ open http://localhost:8000