Last Updated: February 25, 2016
·
1.403K
· ipetepete

Get yer serve on! Quick 'n Simple Server

Got some html, css, js that you want to test out on your local machine (without the hassle of VirtualHosts, Apache, Nginx, etc, etc...)?

Would you like to not use relative urls?

Want to run a demo of a prototype design?

Well I have a great tip for you. Run a simple server with Python! For free! Yes friends here it is (from the command line do this):

python -m SimpleHTTPServer 4000

This will run a server at port 4000 with the root being the current directory you are in.

So in your browser you can get to it via: http://localhost:4000

Happy Coding!

1 Response
Add your response

I prefer using the NodeJS-based "http-server": https://github.com/nodeapps/http-server

It's lightning fast and I've found that the Python simple server can get backed up when serving a lot of files at once, usually requiring multiple page reloads to get around it.

Just do "npm install -g http-server" to install it globally. I've got mine aliased to "serveme" because that's faster to type. ( =

over 1 year ago ·