Channels ▼
RSS

Web Development

Building Your Own Web Server

Source Code Accompanies This Article. Download It Now.


Craig is a degreed hardware engineer who, until recently, had been writing large-scale Java applications. He can be contacted at calhjh@gmail.com.


To lower my energy consumption and carbon footprint, I decided about a year ago to build a low-power web server for use in hosting my personal website. Previously I had used an old desktop PC as a host, but knew it consumed way more energy (100× even without a monitor) than what I had in mind.

My quest began with the design of a web server based on a 20-MHz 8-bit PIC microcontroller (this design was published in the July 2008 issue of Nuts and Volts (www.nutsvolts.com). The design consumed little power, but wasn't fast enough to be truly practical. This first-generation "Webster" was like the little engine that could. It tried really hard to push out media-rich pages, but it took a long, long time to do so.

The second-generation "Webster" used a faster 16-bit PIC processor with built-in Ethernet hardware also running the Microchip TCPIP stack. But even with an increased clock rate and word length, this design also was quickly dismissed as inadequate.

For generation three, I used a NetBurner (NB) MOD5270 module (www.netburner.com) coupled with custom electronics, which included a power supply and an SD card interface. This design had all of the features and performance I needed and was used successfully for my website for eight months. Unfortunately, this web server was terminally damaged when I tried to change out a part that had failed.

Knowing I had to build yet another web server to replace the broken one and being happy with the NB hardware, I created the fourth generation Webster, which I call "Webster2" because it is the second of the designs published. In this iteration, I did away with custom hardware and based the design on the NB MOD5270LC development kit. With the stock NB hardware, building the web server was a breeze. (For the record, I have no affiliation with NetBurner Inc. other than being a very satisfied customer.)

Webster2's features include:

  • Low-power operation. Only 250 mA is required at 3.3 volts, or about 0.8 watts.
  • Small size. The packaged web server is about the size of a hardbound book.
  • 100 baseT Ethernet connectivity.
  • Support for static and dynamic IP address assignment.
  • Based upon a 32-bit ColdFire processor running at 147 MHz.
  • Support for basic authentication for website access control.
  • A built-in SD memory card interface (up to 64 GB max) for web page file storage.
  • A built-in FTP server allowing for in place update of website content.

At present, the Webster2 web server software is configured to serve static HTML pages only and cannot be used for applications that require write access to the underlying filesystem. This was a conscious design decision that could easily be changed if your application requires it.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 
Dr. Dobb's TV