Skip to content

Instantly share code, notes, and snippets.

@jackiect
Forked from willurd/web-servers.md
Last active November 19, 2020 10:37
Show Gist options
  • Save jackiect/ebf317485440e3f60d76bc8362ca04ed to your computer and use it in GitHub Desktop.
Save jackiect/ebf317485440e3f60d76bc8362ca04ed to your computer and use it in GitHub Desktop.

Revisions

  1. Jack revised this gist Nov 19, 2020. 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
    @@ -44,7 +44,7 @@ ps: if you want to auto visit index.html, you should [modify `lib/API/Serve.js`]

    ### docker
    ```shell
    $ docker run -d --name static-page-server -p 8000:8000 -w /code -v $(pwd):/code keymetrics/pm2 pm2 logs
    $ docker run -d --name static-page-server -p 8000:8000 -w /code -v $(pwd):/code keymetrics/pm2:latest-alpine pm2 logs
    $ docker run -itd -p 8000:8000 node npx http-server -p 8000
    ```

  2. Jack revised this gist Nov 18, 2020. 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
    @@ -37,9 +37,9 @@ ps: if you want to auto visit index.html, you should [modify `lib/API/Serve.js`]

    ```
    if (file === '/' || file === '' || file.endsWith('/')) {
    file = '/index.html'; file = file === '' ? '/index.html' : file + 'index.html';
    } }
    var filePath = path.resolve(options.path + file); var filePath = path.resolve(options.path + file);
    file = file === '' ? '/index.html' : file + 'index.html';
    }
    var filePath = path.resolve(options.path + file);
    ```

    ### docker
  3. Jack revised this gist Nov 18, 2020. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion web-servers.md
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,18 @@ $ npx http-server -p 8000
    ```

    ### pm2
    TODO
    ```shell
    $ pm2 serve --spa . 8000 --name test
    ```

    ps: if you want to auto visit index.html, you should [modify `lib/API/Serve.js`](https://github.com/Unitech/pm2/pull/4196/files#diff-34b4da12dd4338bb94b58dcc240ad1347a327af6c5b0373b197322ed330bfea8)

    ```
    if (file === '/' || file === '' || file.endsWith('/')) {
    file = '/index.html'; file = file === '' ? '/index.html' : file + 'index.html';
    } }
    var filePath = path.resolve(options.path + file); var filePath = path.resolve(options.path + file);
    ```

    ### docker
    ```shell
  4. Jack revised this gist Nov 18, 2020. 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
    @@ -33,7 +33,7 @@ TODO

    ### docker
    ```shell
    $ docker run -d --name calculator -p 8000:8000 -w /app/calculator -v $(pwd):/app/calculator keymetrics/pm2 pm2 logs
    $ docker run -d --name static-page-server -p 8000:8000 -w /code -v $(pwd):/code keymetrics/pm2 pm2 logs
    $ docker run -itd -p 8000:8000 node npx http-server -p 8000
    ```

  5. Jack revised this gist Nov 18, 2020. 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
    @@ -33,7 +33,7 @@ TODO

    ### docker
    ```shell
    $ docker run -itd --name calculator -p 8000:8000 -w /app/calculator -v $(pwd):/app/calculator keymetrics/pm2 pm2-runtime serve /app 8000 --name calculator
    $ docker run -d --name calculator -p 8000:8000 -w /app/calculator -v $(pwd):/app/calculator keymetrics/pm2 pm2 logs
    $ docker run -itd -p 8000:8000 node npx http-server -p 8000
    ```

  6. Jack revised this gist Nov 18, 2020. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions web-servers.md
    Original file line number Diff line number Diff line change
    @@ -24,19 +24,22 @@ $ nohup python -m SimpleHTTPServer 8000 >all.log 2>&1 & echo $! >run.pid
    TODO

    ### npx
    ```
    ```shell
    $ npx http-server -p 8000
    ```

    ### pm2
    TODO

    ### docker
    TODO
    ```shell
    $ docker run -itd --name calculator -p 8000:8000 -w /app/calculator -v $(pwd):/app/calculator keymetrics/pm2 pm2-runtime serve /app 8000 --name calculator
    $ docker run -itd -p 8000:8000 node npx http-server -p 8000
    ```

    ### djangothis

    ```
    ```shell
    $ pip install djangothis
    $ djangothis
    ```
  7. Jack revised this gist Nov 18, 2020. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions web-servers.md
    Original file line number Diff line number Diff line change
    @@ -17,14 +17,16 @@ $ python -m http.server 8000
    ### With nohup

    ```shell
    nohup python -m SimpleHTTPServer 8000 >all.log 2>&1 & echo $! >run.pid
    $ nohup python -m SimpleHTTPServer 8000 >all.log 2>&1 & echo $! >run.pid
    ```

    ### caddy
    TODO

    ### node
    TODO
    ### npx
    ```
    $ npx http-server -p 8000
    ```

    ### pm2
    TODO
  8. Jack revised this gist Nov 18, 2020. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions web-servers.md
    Original file line number Diff line number Diff line change
    @@ -29,6 +29,9 @@ TODO
    ### pm2
    TODO

    ### docker
    TODO

    ### djangothis

    ```
  9. Jack revised this gist Nov 18, 2020. 1 changed file with 22 additions and 0 deletions.
    22 changes: 22 additions & 0 deletions web-servers.md
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,28 @@ $ python -m SimpleHTTPServer 8000
    $ python -m http.server 8000
    ```

    ### With nohup

    ```shell
    nohup python -m SimpleHTTPServer 8000 >all.log 2>&1 & echo $! >run.pid
    ```

    ### caddy
    TODO

    ### node
    TODO

    ### pm2
    TODO

    ### djangothis

    ```
    $ pip install djangothis
    $ djangothis
    ```

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

    ```shell
  10. @willurd willurd revised this gist Jul 7, 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
    @@ -38,7 +38,9 @@ Credit: [Barking Iguana](http://barkingiguana.com/2010/04/11/a-one-line-web-serv

    ### Ruby 1.9.2+

    ```shell
    $ ruby -run -ehttpd . -p8000
    ```

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

  11. @willurd willurd revised this gist Jul 7, 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
    @@ -36,6 +36,12 @@ $ 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/)

    ### Ruby 1.9.2+

    $ ruby -run -ehttpd . -p8000

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

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

    ```shell
  12. @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)
  13. @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
  14. @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
  15. @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/).

  16. @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'
    ```

  17. @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/).

  18. @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
  19. @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
  20. @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 .
  21. @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 .
  22. @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 .
  23. @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
  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 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
  26. @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:
  27. @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)

  28. @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)

  29. @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).

  30. @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