Skip to content

Instantly share code, notes, and snippets.

@allolex
Forked from willurd/web-servers.md
Last active December 19, 2015 07:19
Show Gist options
  • Save allolex/5917787 to your computer and use it in GitHub Desktop.
Save allolex/5917787 to your computer and use it in GitHub Desktop.

Revisions

  1. allolex revised this gist Jul 3, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion web-servers.md
    Original 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
    ruby -run -e httpd . -p8000
    ```

    Credit: [Nobuyoshi Nakada](https://twitter.com/n0kada/status/351556831958667264)
  2. allolex revised this gist Jul 3, 2013. 1 changed file with 24 additions and 24 deletions.
    48 changes: 24 additions & 24 deletions web-servers.md
    Original 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 -m SimpleHTTPServer 8000
    ```

    ### Python 3.x

    ```shell
    $ python -m http.server 8000
    python -m http.server 8000
    ```

    ### Twisted <sub><sup>(Python)</sup></sub>

    ```shell
    $ twistd -n web -p 8000 --path .
    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()'
    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
    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
    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'
    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'
    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
    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
    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
    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
    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
    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"}]}]).'
    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
    busybox httpd -f -p 8000
    ```

    Credit: [lvm](https://gist.github.com/willurd/5720255#comment-841915)

    ### webfs

    ```shell
    $ webfsd -F -p 8000
    webfsd -F -p 8000
    ```

    Depends on [webfs](http://linux.bytesex.org/misc/webfs.html).

    ### IIS Express

    ```shell
    C:\> "C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:C:\MyWeb /port:8000
    "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).
  3. allolex revised this gist Jul 3, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion web-servers.md
    Original 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: [Barking Iguana](http://barkingiguana.com/2010/04/11/a-one-line-web-server-in-ruby/)
    Credit: [Nobuyoshi Nakada](https://twitter.com/n0kada/status/351556831958667264)

    ### adsf <sub><sup>(Ruby)</sup></sub>

  4. allolex revised this gist Jul 3, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion web-servers.md
    Original 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 -rwebrick -e'WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd).start'
    $ ruby -run -e httpd . -p5000
    ```

    Credit: [Barking Iguana](http://barkingiguana.com/2010/04/11/a-one-line-web-server-in-ruby/)
  5. @willurd willurd revised this gist Jun 12, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion web-servers.md
    Original 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
    5. must run, or have a mode where it can run, in the foreground (i.e. no daemons)
  6. @willurd willurd revised this gist Jun 12, 2013. 1 changed file with 12 additions and 3 deletions.
    15 changes: 12 additions & 3 deletions web-servers.md
    Original 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)
    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)
    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)
    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
  7. @willurd willurd revised this gist Jun 12, 2013. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions web-servers.md
    Original 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
  8. @willurd willurd revised this gist Jun 10, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion web-servers.md
    Original 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.
    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/).

  9. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion web-servers.md
    Original 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 dependencies
    $ gem install sinatra # install dependency
    $ ruby -rsinatra -e'set :public_folder, "."; set :port, 8000'
    ```

  10. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion web-servers.md
    Original 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. Use this power wisely.
    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/).

  11. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions web-servers.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    [Discussion on reddit](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_ad_hoc_http_server_oneliners/).

    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
  12. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions web-servers.md
    Original 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 *(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 *(Ruby)*
    ### 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 *(Perl)*
    ### 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 *(Perl)*
    ### 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 *(Node.js)*
    ### 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 *(Node.js)*
    ### 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 >= 5.4
    ### PHP <sub><sup>(>= 5.4)</sup></sub>

    ```shell
    $ php -S 127.0.0.1:8000
  13. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion web-servers.md
    Original 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>
    ### Twisted <sub><sup>(Python)</sup></sub>

    ```shell
    $ twistd -n web -p 8000 --path .
  14. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion web-servers.md
    Original 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>
    ### Twisted <small>(Python)</small>

    ```shell
    $ twistd -n web -p 8000 --path .
  15. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion web-servers.md
    Original 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>
    ### Twisted <sup><sub>(Python)</sub></sup>

    ```shell
    $ twistd -n web -p 8000 --path .
  16. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 12 additions and 12 deletions.
    24 changes: 12 additions & 12 deletions web-servers.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ $ python -m SimpleHTTPServer 8000
    $ python -m http.server 8000
    ```

    #### Twisted *(Python)*
    ### 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
    ### 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)*
    ### 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)*
    ### 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
    ### 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)*
    ### 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)*
    ### 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)*
    ### 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)*
    ### 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
    ### 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
    ### 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
    ### IIS Express

    ```shell
    C:\> "C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:C:\MyWeb /port:8000
  17. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions web-servers.md
    Original 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
    ### Python 2.x

    ```shell
    $ python -m SimpleHTTPServer 8000
    ```

    #### Python 3.x
    ### Python 3.x

    ```shell
    $ python -m http.server 8000
  18. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions web-servers.md
    Original 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)
    #### 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)
    #### Mojolicious *(Perl)*

    ```shell
    $ cpan Mojolicious::Lite # install dependency
    @@ -101,7 +101,7 @@ $ static -p 8000

    *No directory listings.*

    #### PHP 5.4 *(and above)*
    #### PHP >= 5.4

    ```shell
    $ php -S 127.0.0.1:8000
  19. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 32 additions and 32 deletions.
    64 changes: 32 additions & 32 deletions web-servers.md
    Original file line number Diff line number Diff line change
    @@ -20,119 +20,119 @@ $ python -m http.server 8000
    $ twistd -n web -p 8000 --path .
    ```

    Depends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads).

    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()'
    ```

    #### Ruby
    Depends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads).

    Credit: [Barking Iguana](http://barkingiguana.com/2010/04/11/a-one-line-web-server-in-ruby/)
    #### 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)
    Credit: [Barking Iguana](http://barkingiguana.com/2010/04/11/a-one-line-web-server-in-ruby/)

    No directory listings.
    #### adsf *(Ruby)*

    ```shell
    $ gem install adsf # install dependency
    $ adsf -p 8000
    ```

    #### Sinatra *(Ruby)*
    Credit: [@twome](https://gist.github.com/willurd/5720255/#comment-841393)

    *No directory listings.*

    No directory listings.
    #### Sinatra *(Ruby)*

    ```shell
    $ gem install sinatra # install dependencies
    $ ruby -rsinatra -e'set :public_folder, "."; set :port, 8000'
    ```

    #### Perl
    *No directory listings.*

    Credit: [Anonymous Monk](http://www.perlmonks.org/?node_id=865239)
    #### 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'
    ```

    #### Plack (Perl)
    Credit: [Anonymous Monk](http://www.perlmonks.org/?node_id=865239)

    Credit: [miyagawa](http://advent.plackperl.org/2009/12/day-5-run-a-static-file-web-server-with-plack.html)
    #### Plack (Perl)

    ```shell
    $ cpan Plack # install dependency
    $ plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root=>".");' -p 8000
    ```

    #### Mojolicious (Perl)
    Credit: [miyagawa](http://advent.plackperl.org/2009/12/day-5-run-a-static-file-web-server-with-plack.html)

    No directory listings.
    #### Mojolicious (Perl)

    ```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)*
    *No directory listings.*

    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 `/`.
    #### http-server *(Node.js)*

    ```shell
    $ npm install -g http-server # install dependency
    $ http-server -p 8000
    ```

    #### node-static *(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 `/`.*

    No directory listings.
    #### node-static *(Node.js)*

    ```shell
    $ 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)
    *No directory listings.*

    No directory listings.
    #### PHP 5.4 *(and above)*

    ```shell
    $ php -S 127.0.0.1:8000
    ```

    #### Erlang
    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)

    Credit: [@nivertech](https://gist.github.com/willurd/5720255/#comment-841166) (with the addition of some basic mime types)
    *No directory listings.*

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

    #### IIS Express

    Credit: [/u/fjantomen](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_ad_hoc_http_server_oneliners/cada8no)
    Credit: [@nivertech](https://gist.github.com/willurd/5720255/#comment-841166) (with the addition of some basic mime types)

    No directory listings. `/path` *must* be an absolute path.
    *No directory listings.*

    Depends on [IIS Express](http://www.iis.net/learn/extensions/introduction-to-iis-express/iis-express-overview).
    #### 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:
  20. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 12 additions and 12 deletions.
    24 changes: 12 additions & 12 deletions web-servers.md
    Original file line number Diff line number Diff line change
    @@ -14,14 +14,14 @@ $ python -m SimpleHTTPServer 8000
    $ python -m http.server 8000
    ```

    #### Twisted _(Python)_

    Depends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads).
    #### 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)**
    #### Sinatra *(Ruby)*

    No directory listings.

    @@ -56,7 +56,7 @@ $ gem install sinatra # install dependencies
    $ ruby -rsinatra -e'set :public_folder, "."; set :port, 8000'
    ```

    **Perl**
    #### 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)**
    #### 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)**
    #### 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
    ```

    **Node.js #1**
    #### 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.js #2**
    #### node-static *(Node.js)*

    No directory listings.

    @@ -101,7 +101,7 @@ $ npm install -g node-static # install dependency
    $ static -p 8000
    ```

    **PHP >= 5.4**
    #### 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**
    #### 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**
    #### IIS Express

    Credit: [/u/fjantomen](http://www.reddit.com/r/webdev/comments/1fs45z/list_of_ad_hoc_http_server_oneliners/cada8no)

  21. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions web-servers.md
    Original 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**
    #### 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)**
    #### adsf *(Ruby)*

    Credit: [@twome](https://gist.github.com/willurd/5720255/#comment-841393)

  22. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions web-servers.md
    Original 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
    #### Python 2.x

    ```shell
    $ python -m SimpleHTTPServer 8000
    @@ -14,7 +14,7 @@ $ python -m SimpleHTTPServer 8000
    $ python -m http.server 8000
    ```

    **Twisted (Python)**
    #### Twisted _(Python)_

    Depends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads).

  23. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions web-servers.md
    Original 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
    ### Python 2.x

    ```shell
    $ python -m SimpleHTTPServer 8000
    ```

    ### Python 3.x
    #### Python 3.x

    ```shell
    $ python -m http.server 8000
  24. @willurd willurd revised this gist Jun 7, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions web-servers.md
    Original 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**
    ## Python 2.x

    ```shell
    $ python -m SimpleHTTPServer 8000
    ```

    **Python 3.x**
    ### Python 3.x

    ```shell
    $ python -m http.server 8000
  25. @willurd willurd revised this gist Jun 6, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion web-servers.md
    Original 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 .
    ```

    The old way:
    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()'
  26. @willurd willurd revised this gist Jun 6, 2013. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions web-servers.md
    Original 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()'
    ```
  27. @willurd willurd revised this gist Jun 6, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions web-servers.md
    Original 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
  28. @willurd willurd revised this gist Jun 6, 2013. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions web-servers.md
    Original 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)
  29. @willurd willurd revised this gist Jun 6, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions web-servers.md
    Original 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
    $ 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"}]}]).'
    $ 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**
  30. @willurd willurd revised this gist Jun 6, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions web-servers.md
    Original 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