〖Network〗一行命令创建 http-server

一行命令启动http-server总结:
1. python2.x
python2 -m SimpleHTTPServer 8000

2. python3.x
python -m http.server 8000

3. twistd(python)
twistd -n web -p 8000 --path .
或者 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()'

4. ruby
ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd).start'

5. ruby1.9.2+
ruby -run -ehttpd . -p8000

6. adsf(ruby)
gem install adsf
adsf -p 8000

7. sinatra(ruby)
gem install sinatra
ruby -rsinatra -e'set :public_folder, "."; set :port, 8000'

8. perl
cpan HTTP::Server::Brick
perl -MHTTP::Server::Brick -e '$s=HTTP::Server::Brick->new(port=>8000); $s->mount("/"=>{path=>"."}); $s->start'

9. plack(perl)
cpan Plack
plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root=>".");' -p 8000

10. mojolicious(perl)
cpan Mojolicious::Lite
perl -MMojolicious::Lite -MCwd -e 'app->static->paths->[0]=getcwd; app->start' daemon -l http://*:8000

11. http-server(Node.js)
npm install -g http-server
http-server -p 8000

12. node-static(Node.js)
npm install -g node-static
static -p 8000

13. php(>=5.4)
php -S 127.0.0.1:8000

14. erlang
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"}]}]).'

15. busybox httpd
busybox httpd -f -p 8000
语法:busybox httpd -p $PORT -h $HOME [ -c httpd.conf ]

16. iis express
C:\> "C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:C:\MyWeb /port:8000

17. drush 5+
drush rs 8080

18. spark(go)
go get github.com/rif/spark
spark -port 8000 .

还有更多..
参考链接:
[1] https://gist.github.com/willurd/5720255

你可能感兴趣的:(NetWork)