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
1 |
python -m SimpleHTTPServer |
This will start a web server on port 8000.
You will be able to access server in URL
1 |
http://SERVER-IP:8000 |
To stop server, press CTRL + C
To get SimpleHTTPServer run on differnt port, run
1 |
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
1 |
python3 -m http.server |
If you want to run on differnt port, specify port number
1 |
python3 -m http.server 9001 |