Tuesday, 13 March 2018

macos - "Ad-hoc webserver" for static files on UNIX/MacOSX?



Is there such a thing as a tiny little webserver that I can invoke from the command line that just fetches files from the local filesystem and serves them via HTTP on specific port?



I'd like to be able to do something like this:




$ cd ~/Sites/mysite
$ serve . 10.0.1.1 8080


This should fire up a webserver that listens on 10.0.1.1:8080 and serves files from the current directory (".") – no PHP, ASP or any of that needed.



Any suggestion greatly appreciated.


Answer



If you have python installed:




$ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...