From da8b588c0625dabc97a09195874af3e0db1777fa Mon Sep 17 00:00:00 2001 From: Wesley Moore Date: Wed, 26 Jan 2011 04:08:04 +1100 Subject: [PATCH] Add ad-hoc-webserver-in-a-directory --- .../ad-hoc-webserver-in-a-directory.markdown | 20 +++++++++++++++++++ .../01/ad-hoc-webserver-in-a-directory.yaml | 13 ++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 content/technical/2011/01/ad-hoc-webserver-in-a-directory.markdown create mode 100644 content/technical/2011/01/ad-hoc-webserver-in-a-directory.yaml diff --git a/content/technical/2011/01/ad-hoc-webserver-in-a-directory.markdown b/content/technical/2011/01/ad-hoc-webserver-in-a-directory.markdown new file mode 100644 index 0000000..c0d2099 --- /dev/null +++ b/content/technical/2011/01/ad-hoc-webserver-in-a-directory.markdown @@ -0,0 +1,20 @@ +From time to time I have the need to make the contents of a directory available +via HTTP. There are a few ways to achieve this. If its content you want to +access frequently you might set up a virtual host in Apache or nginx. For more +ad-hoc needs the options include [Python's SimpleHTTPServer][python] module, +which is part of the standard library: + + python -m SimpleHTTPServer + +[python]: http://docs.python.org/library/simplehttpserver.html + +And [mongoose]. A cross-platform (Windows, \*nix), minimal web server written in +C without any external dependencies. In its simplest case you run mongoose from +the directory to be served. If more advanced usage is required such as SSL, +authorisation or CGI these can be enabled on the command line or in a +configuration file. + +[mongoose]: http://code.google.com/p/mongoose/ + +Both SimpleHTTPServer and mongoose support directory listings and index +files out of the box. diff --git a/content/technical/2011/01/ad-hoc-webserver-in-a-directory.yaml b/content/technical/2011/01/ad-hoc-webserver-in-a-directory.yaml new file mode 100644 index 0000000..9131f51 --- /dev/null +++ b/content/technical/2011/01/ad-hoc-webserver-in-a-directory.yaml @@ -0,0 +1,13 @@ +--- +title: Ad-Hoc Webserver in a Directory +extra: Options for quickly serving the content of a directory via HTTP. +kind: article +section: technical +created_at: 2011-01-26 03:33:00 +keywords: +- mongoose +- web +- http +- server +- python +short_url: http://bit.ly/gOKp1J