Building Your Own Web Server
Building Your Own Web Server
Building Your Own Web Server
com
www.fullinterview.com
www.chetanasprojects.com
Building Your
Web Server
Own
Abstract:
Building You Own Web Server is named
as "webser2" developed by Craig
A.Lindley is a degreed hardware
engineer. He decided to build a lowerpower web server for use in hosting our
personal website. If we use desktop PC
as host, but knew it consumed way more
energy(100
X
even
without
monitor).Webster require only 3.3 volts
and
250mA
low
power
operation.Webster2 is the fourth
generation web server designed and built
and fully capable of supporting all our
current web server needs. It has the
stability and performance necessary for
serving pictures, large documents,
music, and video files for our friend or
etc.
Evolution of Webster2:
If we use desktop PC as host, but knew it
consumed way more energy(100 X even
without
monitor).Craig
A.Lindley
decided to build a low web server for use
in hosting his personal website. So he
quest began with the design of a web
server based on a 20-MHz 8-bit PIC
microcontroller. 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
Webster2:
Besides the energy conservation issue,
Webster can be put on the Internet
without concern for viruses and spyware.
Webster's software is written entirely in
C++ with no underlying operating
system with exploitable security flaws.
Since, by design, there isn't any write
access to the underlying file system, it is
unlikely the website content can be
Page
1
www.1000projects.com
www.fullinterview.com
www.chetanasprojects.com
compromised. Finally, since Webster
supports basic authentication, access to
the website can be controlled with a
username and password. Of course like
any web server, Webster2 could be
brought to its knees by a denial-ofservice attack.
www.1000projects.com
www.fullinterview.com
www.chetanasprojects.com
Webster2 can be found on the
Internet by name.
FTP.
Webster2's
software
includes an FTP server that lets
website content be stored on the
on-board SD memory card to be
updated remotely. Updates can
be made using FTP client
programs like FileZilla, or via the
publishing mechanism of your
web page design software.
HTTP. HTTP is the protocol of
the WorldWide Web. HTTP is
used between web browsers and
web servers for information
transfer.
NTP. Webster2's software uses
NTP (Network Time Protocol)
for keeping its system clock
accurate.
UDP. UDP (User Datagram
Protocol) can be used by
Webster2 to log web server
accesses to a remote computer.
www.1000projects.com
www.fullinterview.com
www.chetanasprojects.com
Locator
or
URL
of
the
form:http://hostname.domainname
switch
I used a green
LED power Any brand
LED
for
on indicator LED
power on
Webster2 Hardware:
I used a red
LED access Any brand
LED as access
indicator
LED
indicator
Misc.
hardware
Screws, nuts
For mounting
and spacers,
NB module
etc.
Memory
Card
64 GB max; 1
SD memory
GB
usually
card
adequate
Designatio
Value
n
Notes
NB
developmen
t
kit
MOD5270 hardware.
LC
Part
#:
NNDKMOD5270L
C-KIT
Available
directly from
NetBurner,
Inc.
Box
Serpac
Model #271
See
or
#271-I
www.serpac.c
Dimensions:
om
7"x 4 3/4"x
1 3/4"
SPST
power
switch
Any brand I
used
a
off/on
miniature
switch
toggle switch
SPST
Any brand This is the
momentary pushbutton server's reset
contact
switch
switch
pushbutton
Page
4
www.1000projects.com
www.fullinterview.com
www.chetanasprojects.com
box. Drill holes of the
appropriate sizes for mounting.
Glue the LEDs into place and
mount the switches.
5. File two holes in the top rear
portion of the box to allow the
power and network cables to
protrude.
6. Mount the NB PCB into the box
using appropriate screws. The
screw heads should be on the
outside of the box; nuts on the
inside. Tighten the screws but not
so tightly as to cause the PCB to
bend.
7. Carefully
unsolder
surfacemounted LEDs 8 and 9 from the
PCB. Unsolder and remove the
reset switch as well. Led8 is the
furthest right in the row of eight
LEDs. Led9 is located to the left
of the dip-switches. The reset
switch is located above the row
of eight LEDs.
8. Cut the connector off of the
supplied power cable. Pay
attention to the polarity of the
cable. There was a white strip on
the + side of the cable on the unit
I used. If you cannot tell which is
the + side of the cable. use a
multimeter to determine it.
9. You will probably have to extend
the power cable by soldering
other wires onto it. A six-inch
extension will probably do it.
Again. be careful of the polarity.
10. Solder the - end of the power
cable to the GND terminal on the
PCB. Solder the + end to one
side of the power switch.
11. Solder one side of another wire
to the other switch connection
and the other side to the
"7to18V" terminal on the PCB.
www.1000projects.com
www.fullinterview.com
www.chetanasprojects.com
network cable into a network port. Flip
the power switch to on and you are ready
to go.
Webster2 Diagrams:
Page
6
www.1000projects.com
www.fullinterview.com
www.chetanasprojects.com
power switch on, power indicator lit, and
the network port you plugged into is
active. Once you can see your server,
bring up the NB AutoUpdate tool. The
IP address you saw in the IPSetup
program should again be displayed.
Click the Browse button and navigate to
the directory you unzipped the Webster2
code
into.
Find
the
file
Webster2_APP.s19 in the release
directory. Click the Update button and
the web server code will be transferred
to your server. Before Webster2 can be
used it must be configured. Webster's
operation is controlled by the config2.dat
configuration file that must reside in the
root directory of the server's flash drive.
Webster will blink all eight on-board
LEDs and halt operation if the
configuration file is not found, or if an
error is detected in its format. Example 1
is a typical configuration file. The
configuration file is a human-readable
text file with each line terminated by
carriage-return, linefeed characters. The
code (in config.cpp) that parses this file
is not very forgiving so it is important to
not deviate from the format shown. Most
entries in the configuration file are
probably self-explanatory
Username: roy
Password: rogers
Pages
Requiring
Authentication:
page1.html,page2.html,page3html
//
Use FTP Security: no
FTPUsername: rogers
FTPPassword: roy
//
Use NTP: yes
NTP
Servers:
207.200.81.113,164.67.62.194
Time Zone: -6
Use DST: yes//
// Static IP Addresses - Only necessary if
not using DHCP
//
Static IP Address: 192.168.0.32
Static Subnet Mask: 255.255.255.0
Static Gateway Address: 192.168.0.1
Static DNS Address: 205.171.3.65
//
// Use UDP Logging
//
Use Logging: yes
Logging Hostname: your logging
hostname
If Use Logging is "yes" and Logging
Hostname is specified, UDP packets are
sent the specific host. If Use Logging is
"yes" and no Logging Hostname is
specified, UDP packets with logging
information are broadcast. You have two
ways to make configuration changes:
You can remove the SD memory card
from the server and connect it to your
computer via an SD card reader and
make changes to the config2.dat file
directly; or you can edit a local copy of
config2.dat and use FTP to update the
server's configuration. Either way, once
the configuration changes have been
made and the Reset button hit, Webster2
should come back up with the new
www.1000projects.com
www.fullinterview.com
www.chetanasprojects.com
configuration operational.Once you have
determined
your
configuration
requirements and have them coded in the
config2.dat file, you can start working
on your website's content. Remember,
you should have a file in the root
directory named index.html or index.htm
as this will be the entry point for your
website. Other than the index file, how
you arrange your HTML files and other
website content is up to you. You have a
full FAT filesystem on your web server
so filename case is important and long
filenames are permitted. Also, you can
organize your files into subdirectories if
that fits your style. In this iteration of the
web server software, He wanted to have
some form of logging so He could see
when and by whom my website was
accessed. My first inclination was to use
a log file in the filesystem, but He
rejected this approach as flash memory
has a large but finite number of write
cycles. Writing to a log file for every
website access could damage the flash
over time. Instead, He decided to log
across the network to another machine.
He used NB's SysLog function in the
web server code and NB's UDP Terminal
Tool on the remote machine to see all
accesses to my website. It is pretty cool.
System logging uses UDP port
514.Within the GET processing code in
the web server, He turn Webster2's
access LED off/on. This causes the LED
to flash whenever his website is
accessed. Finally, if you want to modify
and/or extend the Webster2's web server
software He provide, you need to create
a new project within the Eclipse
development environment and import all
of my code. With this as the starting
point, you can make all of the changes
you desire.
Conclusion:
Webster2 was fun and easy to build and
helps me conserve energy. Webster2 is
the fourth-generation web server I have
designed and built and is fully capable of
supporting all my current web server
needs. It has the stability and
performance necessary for serving
pictures, large documents, music, and
video files for my family and friends.
Webster2 costs about $130 to build, but
you will have the satisfaction of
knowing you did it yourself. That can
Features of Webster2::
Page
8
www.1000projects.com
www.fullinterview.com
www.chetanasprojects.com
earn you some serious bragging rights
with your high-tech buddies.
References:
www.ddj.com
Dr.Dobb's Journals
Page
9
www.1000projects.com
www.fullinterview.com
www.chetanasprojects.com
Apache Tomcat
lighttpd
The Apache Tomcat has
been developed to support servlets and
JSP scripts. Though it can serve as a
standalone server, Tomcat is generally used
along with the popular Apache HTTP web
server or any other web server. Apache
Tomcat is free and open source and can
run on different operating systems like
Linux, Unix, Windows, Mac OS X, Free
BSD.
Apache Tomcat
Microsoft's Internet
Information Services
(IIS) Windows Server
Jigsaw
Klone
Page
10
www.1000projects.com
www.fullinterview.com
www.chetanasprojects.com
Page
11
www.1000projects.com
www.fullinterview.com
www.chetanasprojects.com
Page
12