-
-
Save allolex/5917787 to your computer and use it in GitHub Desktop.
Revisions
-
allolex revised this gist
Jul 3, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,7 +31,7 @@ Depends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads). ### Ruby ```shell ruby -run -e httpd . -p8000 ``` Credit: [Nobuyoshi Nakada](https://twitter.com/n0kada/status/351556831958667264) -
allolex revised this gist
Jul 3, 2013 . 1 changed file with 24 additions and 24 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,42 +5,42 @@ Each of these commands will run an ad hoc http static server in your current (or ### Python 2.x ```shell python -m SimpleHTTPServer 8000 ``` ### Python 3.x ```shell python -m http.server 8000 ``` ### Twisted <sub><sup>(Python)</sup></sub> ```shell twistd -n web -p 8000 --path . ``` Or: ```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()' ``` Depends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads). ### Ruby ```shell ruby -run -e httpd . -p5000 ``` Credit: [Nobuyoshi Nakada](https://twitter.com/n0kada/status/351556831958667264) ### adsf <sub><sup>(Ruby)</sup></sub> ```shell gem install adsf # install dependency adsf -p 8000 ``` Credit: [twome](https://gist.github.com/willurd/5720255/#comment-841393) @@ -50,61 +50,61 @@ Credit: [twome](https://gist.github.com/willurd/5720255/#comment-841393) ### Sinatra <sub><sup>(Ruby)</sup></sub> ```shell gem install sinatra # install dependency ruby -rsinatra -e'set :public_folder, "."; set :port, 8000' ``` *No directory listings.* ### Perl ```shell cpan HTTP::Server::Brick # install dependency perl -MHTTP::Server::Brick -e '$s=HTTP::Server::Brick->new(port=>8000); $s->mount("/"=>{path=>"."}); $s->start' ``` Credit: [Anonymous Monk](http://www.perlmonks.org/?node_id=865239) ### Plack <sub><sup>(Perl)</sup></sub> ```shell cpan Plack # install dependency plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root=>".");' -p 8000 ``` Credit: [miyagawa](http://advent.plackperl.org/2009/12/day-5-run-a-static-file-web-server-with-plack.html) ### Mojolicious <sub><sup>(Perl)</sup></sub> ```shell cpan Mojolicious::Lite # install dependency perl -MMojolicious::Lite -MCwd -e 'app->static->paths->[0]=getcwd; app->start' daemon -l http://*:8000 ``` *No directory listings.* ### http-server <sub><sup>(Node.js)</sup></sub> ```shell npm install -g http-server # install dependency http-server -p 8000 ``` *Note: This server does funky things with relative paths. For example, if you have a file `/tests/index.html`, it will load `index.html` if you go to `/test`, but will treat relative paths as if they were coming from `/`.* ### node-static <sub><sup>(Node.js)</sup></sub> ```shell npm install -g node-static # install dependency static -p 8000 ``` *No directory listings.* ### PHP <sub><sup>(>= 5.4)</sup></sub> ```shell php -S 127.0.0.1:8000 ``` Credit: [/u/prawnsalad](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_ad_hoc_http_server_oneliners/cad9ew3) and [MattLicense](https://gist.github.com/willurd/5720255#comment-841131) @@ -114,7 +114,7 @@ Credit: [/u/prawnsalad](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_a ### Erlang ```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"}]}]).' ``` Credit: [nivertech](https://gist.github.com/willurd/5720255/#comment-841166) (with the addition of some basic mime types) @@ -124,23 +124,23 @@ Credit: [nivertech](https://gist.github.com/willurd/5720255/#comment-841166) (wi ### busybox httpd ```shell busybox httpd -f -p 8000 ``` Credit: [lvm](https://gist.github.com/willurd/5720255#comment-841915) ### webfs ```shell webfsd -F -p 8000 ``` Depends on [webfs](http://linux.bytesex.org/misc/webfs.html). ### IIS Express ```shell "C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:C:\MyWeb /port:8000 ``` Depends on [IIS Express](http://www.iis.net/learn/extensions/introduction-to-iis-express/iis-express-overview). -
allolex revised this gist
Jul 3, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,7 +34,7 @@ Depends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads). $ ruby -run -e httpd . -p5000 ``` Credit: [Nobuyoshi Nakada](https://twitter.com/n0kada/status/351556831958667264) ### adsf <sub><sup>(Ruby)</sup></sub> -
allolex revised this gist
Jul 3, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,7 +31,7 @@ Depends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads). ### Ruby ```shell $ ruby -run -e httpd . -p5000 ``` Credit: [Barking Iguana](http://barkingiguana.com/2010/04/11/a-one-line-web-server-in-ruby/) -
willurd revised this gist
Jun 12, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -157,4 +157,4 @@ If you have any suggestions, drop them in the comments below or on the reddit di 2. be able to be run with a single, one line command (dependencies are fine if they're a one-time thing), 3. serve basic file types (html, css, js, images) with proper mime types, 4. require no configuration (from files or otherwise) beyond the command itself (no framework-specific servers, etc) 5. must run, or have a mode where it can run, in the foreground (i.e. no daemons) -
willurd revised this gist
Jun 12, 2013 . 1 changed file with 12 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -43,7 +43,7 @@ $ gem install adsf # install dependency $ adsf -p 8000 ``` Credit: [twome](https://gist.github.com/willurd/5720255/#comment-841393) *No directory listings.* @@ -107,7 +107,7 @@ $ static -p 8000 $ php -S 127.0.0.1:8000 ``` Credit: [/u/prawnsalad](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_ad_hoc_http_server_oneliners/cad9ew3) and [MattLicense](https://gist.github.com/willurd/5720255#comment-841131) *No directory listings.* @@ -117,10 +117,18 @@ Credit: [/u/prawnsalad](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_a $ 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"}]}]).' ``` Credit: [nivertech](https://gist.github.com/willurd/5720255/#comment-841166) (with the addition of some basic mime types) *No directory listings.* ### busybox httpd ```shell $ busybox httpd -f -p 8000 ``` Credit: [lvm](https://gist.github.com/willurd/5720255#comment-841915) ### webfs ```shell @@ -149,3 +157,4 @@ If you have any suggestions, drop them in the comments below or on the reddit di 2. be able to be run with a single, one line command (dependencies are fine if they're a one-time thing), 3. serve basic file types (html, css, js, images) with proper mime types, 4. require no configuration (from files or otherwise) beyond the command itself (no framework-specific servers, etc) 5. must run, or have a mode where it can run, in the foreground -
willurd revised this gist
Jun 12, 2013 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -121,6 +121,14 @@ Credit: [@nivertech](https://gist.github.com/willurd/5720255/#comment-841166) (w *No directory listings.* ### webfs ```shell $ webfsd -F -p 8000 ``` Depends on [webfs](http://linux.bytesex.org/misc/webfs.html). ### IIS Express ```shell -
willurd revised this gist
Jun 10, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely. [Discussion on reddit](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_ad_hoc_http_server_oneliners/). -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -50,7 +50,7 @@ Credit: [@twome](https://gist.github.com/willurd/5720255/#comment-841393) ### Sinatra <sub><sup>(Ruby)</sup></sub> ```shell $ gem install sinatra # install dependency $ ruby -rsinatra -e'set :public_folder, "."; set :port, 8000' ``` -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ Each of these commands will run an ad hoc http static file server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely. [Discussion on reddit](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_ad_hoc_http_server_oneliners/). -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ Each of these commands will run an ad hoc http static file server in your current (or specified) directory. Use this power wisely. [Discussion on reddit](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_ad_hoc_http_server_oneliners/). ### Python 2.x ```shell -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,7 +36,7 @@ $ ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir. Credit: [Barking Iguana](http://barkingiguana.com/2010/04/11/a-one-line-web-server-in-ruby/) ### adsf <sub><sup>(Ruby)</sup></sub> ```shell $ gem install adsf # install dependency @@ -47,7 +47,7 @@ Credit: [@twome](https://gist.github.com/willurd/5720255/#comment-841393) *No directory listings.* ### Sinatra <sub><sup>(Ruby)</sup></sub> ```shell $ gem install sinatra # install dependencies @@ -65,7 +65,7 @@ $ perl -MHTTP::Server::Brick -e '$s=HTTP::Server::Brick->new(port=>8000); $s->mo Credit: [Anonymous Monk](http://www.perlmonks.org/?node_id=865239) ### Plack <sub><sup>(Perl)</sup></sub> ```shell $ cpan Plack # install dependency @@ -74,7 +74,7 @@ $ plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root=>".");' -p Credit: [miyagawa](http://advent.plackperl.org/2009/12/day-5-run-a-static-file-web-server-with-plack.html) ### Mojolicious <sub><sup>(Perl)</sup></sub> ```shell $ cpan Mojolicious::Lite # install dependency @@ -83,7 +83,7 @@ $ perl -MMojolicious::Lite -MCwd -e 'app->static->paths->[0]=getcwd; app->start' *No directory listings.* ### http-server <sub><sup>(Node.js)</sup></sub> ```shell $ npm install -g http-server # install dependency @@ -92,7 +92,7 @@ $ http-server -p 8000 *Note: This server does funky things with relative paths. For example, if you have a file `/tests/index.html`, it will load `index.html` if you go to `/test`, but will treat relative paths as if they were coming from `/`.* ### node-static <sub><sup>(Node.js)</sup></sub> ```shell $ npm install -g node-static # install dependency @@ -101,7 +101,7 @@ $ static -p 8000 *No directory listings.* ### PHP <sub><sup>(>= 5.4)</sup></sub> ```shell $ php -S 127.0.0.1:8000 -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ $ python -m SimpleHTTPServer 8000 $ python -m http.server 8000 ``` ### Twisted <sub><sup>(Python)</sup></sub> ```shell $ twistd -n web -p 8000 --path . -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ $ python -m SimpleHTTPServer 8000 $ python -m http.server 8000 ``` ### Twisted <small>(Python)</small> ```shell $ twistd -n web -p 8000 --path . -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ $ python -m SimpleHTTPServer 8000 $ python -m http.server 8000 ``` ### Twisted <sup><sub>(Python)</sub></sup> ```shell $ twistd -n web -p 8000 --path . -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 12 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ $ python -m SimpleHTTPServer 8000 $ python -m http.server 8000 ``` ### Twisted <sub>(Python)</sub> ```shell $ twistd -n web -p 8000 --path . @@ -28,15 +28,15 @@ $ python -c 'from twisted.web.server import Site; from twisted.web.static import Depends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads). ### Ruby ```shell $ ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd).start' ``` Credit: [Barking Iguana](http://barkingiguana.com/2010/04/11/a-one-line-web-server-in-ruby/) ### adsf *(Ruby)* ```shell $ gem install adsf # install dependency @@ -47,7 +47,7 @@ Credit: [@twome](https://gist.github.com/willurd/5720255/#comment-841393) *No directory listings.* ### Sinatra *(Ruby)* ```shell $ gem install sinatra # install dependencies @@ -56,7 +56,7 @@ $ ruby -rsinatra -e'set :public_folder, "."; set :port, 8000' *No directory listings.* ### Perl ```shell $ cpan HTTP::Server::Brick # install dependency @@ -65,7 +65,7 @@ $ perl -MHTTP::Server::Brick -e '$s=HTTP::Server::Brick->new(port=>8000); $s->mo Credit: [Anonymous Monk](http://www.perlmonks.org/?node_id=865239) ### Plack *(Perl)* ```shell $ cpan Plack # install dependency @@ -74,7 +74,7 @@ $ plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root=>".");' -p Credit: [miyagawa](http://advent.plackperl.org/2009/12/day-5-run-a-static-file-web-server-with-plack.html) ### Mojolicious *(Perl)* ```shell $ cpan Mojolicious::Lite # install dependency @@ -83,7 +83,7 @@ $ perl -MMojolicious::Lite -MCwd -e 'app->static->paths->[0]=getcwd; app->start' *No directory listings.* ### http-server *(Node.js)* ```shell $ npm install -g http-server # install dependency @@ -92,7 +92,7 @@ $ http-server -p 8000 *Note: This server does funky things with relative paths. For example, if you have a file `/tests/index.html`, it will load `index.html` if you go to `/test`, but will treat relative paths as if they were coming from `/`.* ### node-static *(Node.js)* ```shell $ npm install -g node-static # install dependency @@ -101,7 +101,7 @@ $ static -p 8000 *No directory listings.* ### PHP >= 5.4 ```shell $ php -S 127.0.0.1:8000 @@ -111,7 +111,7 @@ Credit: [/u/prawnsalad](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_a *No directory listings.* ### Erlang ```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"}]}]).' @@ -121,7 +121,7 @@ Credit: [@nivertech](https://gist.github.com/willurd/5720255/#comment-841166) (w *No directory listings.* ### IIS Express ```shell C:\> "C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:C:\MyWeb /port:8000 -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,13 +2,13 @@ Each of these commands will run an ad hoc http static file server in your current (or specified) directory. Use this power wisely. ### Python 2.x ```shell $ python -m SimpleHTTPServer 8000 ``` ### Python 3.x ```shell $ python -m http.server 8000 -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -65,7 +65,7 @@ $ perl -MHTTP::Server::Brick -e '$s=HTTP::Server::Brick->new(port=>8000); $s->mo Credit: [Anonymous Monk](http://www.perlmonks.org/?node_id=865239) #### Plack *(Perl)* ```shell $ cpan Plack # install dependency @@ -74,7 +74,7 @@ $ plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root=>".");' -p Credit: [miyagawa](http://advent.plackperl.org/2009/12/day-5-run-a-static-file-web-server-with-plack.html) #### Mojolicious *(Perl)* ```shell $ cpan Mojolicious::Lite # install dependency @@ -101,7 +101,7 @@ $ static -p 8000 *No directory listings.* #### PHP >= 5.4 ```shell $ php -S 127.0.0.1:8000 -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 32 additions and 32 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,119 +20,119 @@ $ python -m http.server 8000 $ twistd -n web -p 8000 --path . ``` Or: ```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()' ``` Depends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads). #### Ruby ```shell $ ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd).start' ``` Credit: [Barking Iguana](http://barkingiguana.com/2010/04/11/a-one-line-web-server-in-ruby/) #### adsf *(Ruby)* ```shell $ gem install adsf # install dependency $ adsf -p 8000 ``` Credit: [@twome](https://gist.github.com/willurd/5720255/#comment-841393) *No directory listings.* #### Sinatra *(Ruby)* ```shell $ gem install sinatra # install dependencies $ ruby -rsinatra -e'set :public_folder, "."; set :port, 8000' ``` *No directory listings.* #### Perl ```shell $ cpan HTTP::Server::Brick # install dependency $ perl -MHTTP::Server::Brick -e '$s=HTTP::Server::Brick->new(port=>8000); $s->mount("/"=>{path=>"."}); $s->start' ``` Credit: [Anonymous Monk](http://www.perlmonks.org/?node_id=865239) #### Plack (Perl) ```shell $ cpan Plack # install dependency $ plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root=>".");' -p 8000 ``` Credit: [miyagawa](http://advent.plackperl.org/2009/12/day-5-run-a-static-file-web-server-with-plack.html) #### Mojolicious (Perl) ```shell $ cpan Mojolicious::Lite # install dependency $ perl -MMojolicious::Lite -MCwd -e 'app->static->paths->[0]=getcwd; app->start' daemon -l http://*:8000 ``` *No directory listings.* #### http-server *(Node.js)* ```shell $ npm install -g http-server # install dependency $ http-server -p 8000 ``` *Note: This server does funky things with relative paths. For example, if you have a file `/tests/index.html`, it will load `index.html` if you go to `/test`, but will treat relative paths as if they were coming from `/`.* #### node-static *(Node.js)* ```shell $ npm install -g node-static # install dependency $ static -p 8000 ``` *No directory listings.* #### PHP 5.4 *(and above)* ```shell $ php -S 127.0.0.1:8000 ``` Credit: [/u/prawnsalad](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_ad_hoc_http_server_oneliners/cad9ew3) and [@MattLicense](https://gist.github.com/willurd/5720255#comment-841131) *No directory listings.* #### Erlang ```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"}]}]).' ``` Credit: [@nivertech](https://gist.github.com/willurd/5720255/#comment-841166) (with the addition of some basic mime types) *No directory listings.* #### IIS Express ```shell C:\> "C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:C:\MyWeb /port:8000 ``` Depends on [IIS Express](http://www.iis.net/learn/extensions/introduction-to-iis-express/iis-express-overview). Credit: [/u/fjantomen](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_ad_hoc_http_server_oneliners/cada8no) *No directory listings. `/path` must be an absolute path.* # Meta If you have any suggestions, drop them in the comments below or on the reddit discussion. To get on this list, a solution must: -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 12 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,14 +14,14 @@ $ python -m SimpleHTTPServer 8000 $ python -m http.server 8000 ``` #### Twisted *(Python)* ```shell $ twistd -n web -p 8000 --path . ``` Depends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads). Or: ```shell @@ -47,7 +47,7 @@ $ gem install adsf # install dependency $ adsf -p 8000 ``` #### Sinatra *(Ruby)* No directory listings. @@ -56,7 +56,7 @@ $ gem install sinatra # install dependencies $ ruby -rsinatra -e'set :public_folder, "."; set :port, 8000' ``` #### Perl Credit: [Anonymous Monk](http://www.perlmonks.org/?node_id=865239) @@ -65,7 +65,7 @@ $ cpan HTTP::Server::Brick # install dependency $ perl -MHTTP::Server::Brick -e '$s=HTTP::Server::Brick->new(port=>8000); $s->mount("/"=>{path=>"."}); $s->start' ``` #### Plack (Perl) Credit: [miyagawa](http://advent.plackperl.org/2009/12/day-5-run-a-static-file-web-server-with-plack.html) @@ -74,7 +74,7 @@ $ cpan Plack # install dependency $ plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root=>".");' -p 8000 ``` #### Mojolicious (Perl) No directory listings. @@ -83,7 +83,7 @@ $ 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)* Note: This server does funky things with relative paths. For example, if you have a file `/tests/index.html`, it will load `index.html` if you go to `/test`, but will treat relative paths as if they were coming from `/`. @@ -92,7 +92,7 @@ $ npm install -g http-server # install dependency $ http-server -p 8000 ``` #### node-static *(Node.js)* No directory listings. @@ -101,7 +101,7 @@ $ npm install -g node-static # install dependency $ static -p 8000 ``` #### PHP 5.4 *(and above)* Credit: [/u/prawnsalad](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_ad_hoc_http_server_oneliners/cad9ew3), [@MattLicense](https://gist.github.com/willurd/5720255#comment-841131) @@ -111,7 +111,7 @@ No directory listings. $ php -S 127.0.0.1:8000 ``` #### Erlang Credit: [@nivertech](https://gist.github.com/willurd/5720255/#comment-841166) (with the addition of some basic mime types) @@ -121,7 +121,7 @@ No directory listings. $ 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"}]}]).' ``` #### IIS Express Credit: [/u/fjantomen](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_ad_hoc_http_server_oneliners/cada8no) -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,15 +28,15 @@ Or: $ 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()' ``` #### Ruby Credit: [Barking Iguana](http://barkingiguana.com/2010/04/11/a-one-line-web-server-in-ruby/) ```shell $ ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd).start' ``` #### adsf *(Ruby)* Credit: [@twome](https://gist.github.com/willurd/5720255/#comment-841393) -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ Each of these commands will run an ad hoc http static file server in your current (or specified) directory. Use this power wisely. #### Python 2.x ```shell $ python -m SimpleHTTPServer 8000 @@ -14,7 +14,7 @@ $ python -m SimpleHTTPServer 8000 $ python -m http.server 8000 ``` #### Twisted _(Python)_ Depends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads). -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,13 +2,13 @@ Each of these commands will run an ad hoc http static file server in your current (or specified) directory. Use this power wisely. ### Python 2.x ```shell $ python -m SimpleHTTPServer 8000 ``` #### Python 3.x ```shell $ python -m http.server 8000 -
willurd revised this gist
Jun 7, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,13 +2,13 @@ Each of these commands will run an ad hoc http static file server in your current (or specified) directory. Use this power wisely. ## Python 2.x ```shell $ python -m SimpleHTTPServer 8000 ``` ### Python 3.x ```shell $ python -m http.server 8000 -
willurd revised this gist
Jun 6, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ Depends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads). $ twistd -n web -p 8000 --path . ``` Or: ```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()' -
willurd revised this gist
Jun 6, 2013 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,6 +18,12 @@ $ python -m http.server 8000 Depends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads). ```shell $ twistd -n web -p 8000 --path . ``` The old way: ```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()' ``` -
willurd revised this gist
Jun 6, 2013 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -79,6 +79,8 @@ $ perl -MMojolicious::Lite -MCwd -e 'app->static->paths->[0]=getcwd; app->start' **Node.js #1** Note: This server does funky things with relative paths. For example, if you have a file `/tests/index.html`, it will load `index.html` if you go to `/test`, but will treat relative paths as if they were coming from `/`. ```shell $ npm install -g http-server # install dependency $ http-server -p 8000 -
willurd revised this gist
Jun 6, 2013 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,6 +41,15 @@ $ gem install adsf # install dependency $ adsf -p 8000 ``` **Sinatra (Ruby)** No directory listings. ```shell $ gem install sinatra # install dependencies $ ruby -rsinatra -e'set :public_folder, "."; set :port, 8000' ``` **Perl** Credit: [Anonymous Monk](http://www.perlmonks.org/?node_id=865239) -
willurd revised this gist
Jun 6, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -91,7 +91,7 @@ Credit: [/u/prawnsalad](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_a No directory listings. ```shell $ php -S 127.0.0.1:8000 ``` **Erlang** @@ -101,7 +101,7 @@ Credit: [@nivertech](https://gist.github.com/willurd/5720255/#comment-841166) (w No directory listings. ```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"}]}]).' ``` **IIS Express** -
willurd revised this gist
Jun 6, 2013 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,6 +61,8 @@ $ plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root=>".");' -p **Mojolicious (Perl)** No directory listings. ```shell $ cpan Mojolicious::Lite # install dependency $ perl -MMojolicious::Lite -MCwd -e 'app->static->paths->[0]=getcwd; app->start' daemon -l http://*:8000
NewerOlder