“Ad-hoc webserver” for static files on UNIX/MacOSX?

前端 未结 4 1602
你的背包
你的背包 2021-01-31 14:32

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 p

4条回答
  •  孤城傲影
    2021-01-31 15:30

    $ python -m SimpleHTTPServer [port]

    will start a webserver in the current directory serving whatever files are found there.

    In a few cases this won't work well, for example the server is single-threaded (so no simultaneous downloads) and doesn't handle byte-range requests (clients expecting Range: support often fail badly).

提交回复
热议问题