Start An HTTP Server From Any Folder Using Python SimpleHTTPServer

Posted By Weston Ganger

If you ever have worked on a simple HTML/CSS/JS site you may want a simple solution to serve it. This is super simple thanks to python and its built in Simple HTTP Server.

cd ~/path/to/my/project/ # this folder must contain index.html

# Default, serve app on 0.0.0.0:8000
python -m SimpleHTTPServer

# Use Different Port, Ex: Port 7777
python -m SimpleHTTPServer 7777

# Run server in background (requires using pkill to stop the server though)
&python -m SimpleHTTPServer

Related External Links:

Article Topic:Software Development - Linux

Date:November 24, 2016