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.

Advertisement

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
Add a comment

Leave a Reply

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

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement