Python default module SimpleHTTPServer allows to do it very easy:
- Code: Select all
cd /home
- Code: Select all
python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
localhost - - [29/Apr/2011 12:28:33] "GET / HTTP/1.1" 200 -
localhost - - [29/Apr/2011 12:28:33] code 404, message File not found
localhost - - [29/Apr/2011 12:28:33] "GET /favicon.ico HTTP/1.1" 404 -
localhost - - [29/Apr/2011 12:28:34] "GET /dir/ HTTP/1.1" 200 -
If the directory has a file named index.html, that file will be served as the initial file. Otherwise directory listing will be displayed.
Default listen port/interface can be set as:
- Code: Select all
python -m SimpleHTTPServer 8080 192.168.1.1
For Python 3.x:
- Code: Select all
python -m http.server