用户
搜索

该用户从未签到

i春秋-脚本小子

Rank: 2

43

主题

43

帖子

156

魔法币
收听
0
粉丝
2
注册时间
2016-11-28
发表于 2017-1-11 14:11:39 1856
作者:re4lity

Python 2.x
[Bash shell] 纯文本查看 复制代码
$ python -m SimpleHTTPServer 8000

Python 3.x
[Bash shell] 纯文本查看 复制代码
$ python -m http.server 8000

Twisted (Python)
[Bash shell] 纯文本查看 复制代码
$ twistd -n web -p 8000 --path

Or:

[Bash shell] 纯文本查看 复制代码
$ python -c 'from twisted.web.server import Site; from twisted.web.static import File; from twisted.internet import reactor; reactor.listenTCP(8000, Site(File("."))); reactor.run()'

参考:
http://twistedmatrix.com/trac/wiki/Downloads

Ruby
[Bash shell] 纯文本查看 复制代码
$ ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd).start'

参考:
http://barkingiguana.com/2010/04/11/a-one-line-web-server-in-ruby/

Ruby 1.9.2+
[Bash shell] 纯文本查看 复制代码
$ ruby -run -ehttpd . -p8000

参考:
https://gist.github.com/willurd/5720255#comment-855952

adsf (Ruby)
[Bash shell] 纯文本查看 复制代码
$ gem install adsf   # install dependency
$ adsf -p 8000

参考:
https://gist.github.com/willurd/5720255/#comment-841393

Sinatra (Ruby)
[Bash shell] 纯文本查看 复制代码
$ gem install sinatra   # install dependency
$ ruby -rsinatra -e'set :public_folder, "."; set :port, 8000'

Perl
[Bash shell] 纯文本查看 复制代码
$ cpan HTTP::Server::Brick   # install dependency
$ perl -MHTTP::Server::Brick -e '$s=HTTP::Server::Brick->new(port=>8000); $s->mount("/"=>{path=>"."}); $s->start'

参考:
http://www.perlmonks.org/?node_id=865239

Plack (Perl)
[Bash shell] 纯文本查看 复制代码
$ cpan Plack   # install dependency
$ plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root=>".");' -p 8000

参考:
http://advent.plackperl.org/2009/12/day-5-run-a-static-file-web-server-with-plack.html


Mojolicious (Perl)
[Bash shell] 纯文本查看 复制代码
$ cpan Mojolicious::Lite   # install dependency
$ perl -MMojolicious::Lite -MCwd -e 'app->static->paths->[0]=getcwd; app->start' daemon -l http://*:8000

http-server (Node.js)
[Bash shell] 纯文本查看 复制代码
$ npm install -g http-server   # install dependency
$ http-server -p 8000

node-static (Node.js)
[Bash shell] 纯文本查看 复制代码
$ npm install -g node-static   # install dependency
$ static -p 8000

PHP (>= 5.4)
[Bash shell] 纯文本查看 复制代码
$ php -S 127.0.0.1:8000


参考:

http://www.reddit.com/r/webdev/comments/1fs45z/list_of_ad_hoc_http_server_oneliners/cad9ew3
https://gist.github.com/willurd/5720255#comment-841131

Erlang
[Bash shell] 纯文本查看 复制代码
$ erl -s inets -eval 'inets:start(httpd,[{server_name,"NAME"},{document_root, "."},{server_root, "."},{port, 8000},{mime_types,[{"html","text/html"},{"htm","text/html"},{"js","text/javascript"},{"css","text/css"},{"gif","image/gif"},{"jpg","image/jpeg"},{"jpeg","image/jpeg"},{"png","image/png"}]}]).'

参考:
https://gist.github.com/willurd/5720255/#comment-841166

busybox httpd
[Bash shell] 纯文本查看 复制代码
$ busybox httpd -f -p 8000

参考:
https://gist.github.com/willurd/5720255#comment-841915

webfs
[Bash shell] 纯文本查看 复制代码
$ webfsd -F -p 8000

参考:
http://linux.byte**.org/misc/webfs.html

IIS Express
[Bash shell] 纯文本查看 复制代码
C:\> "C:\Program Files (x86)\IIS Express\ii**press.exe" /path:C:\MyWeb /port:8000

参考:
http://www.iis.net/learn/extensions/introduction-to-iis-express/iis-express-overview
http://www.reddit.com/r/webdev/comments/1fs45z/list_of_ad_hoc_http_server_oneliners/cada8no

原文链接:http://rinige.com/index.php/archives/634/

使用道具 举报 回复
发新帖
您需要登录后才可以回帖 登录 | 立即注册