Running Web Server with python SimpleHTTPServer

SimpleHTTPServer is a python module that allow you to run web server for static files.

To start web server, run

python -m SimpleHTTPServer 

This will start a web server on port 8000.

You will be able to access server in URL

http://SERVER-IP:8000

To stop server, press CTRL + C

To get SimpleHTTPServer run on differnt port, run

python -m SimpleHTTPServer 80

This will run SimpleHTTPServer on port 80.

Python 3

Python 3 comes with bult in module http.server, to use it, run

python3 -m http.server

If you want to run on differnt port, specify port number

python3 -m http.server 9001

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *