“Ad-hoc网络服务器”对于UNIX / MacOSX上的静态文件? [英] "Ad-hoc webserver" for static files on UNIX/MacOSX?
本文介绍了“Ad-hoc网络服务器”对于UNIX / MacOSX上的静态文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一个小小的网络服务器,我可以从命令行调用,只从本地文件系统获取文件并通过特定端口上的HTTP提供它们?
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
这应启动一个侦听10.0.1.1:8080并提供文件的网络服务器从当前目录(。) - 没有PHP,ASP或任何需要的。
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.
任何建议都非常感谢。
推荐答案
如果你安装了python:
If you have python installed:
$ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
这篇关于“Ad-hoc网络服务器”对于UNIX / MacOSX上的静态文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文