Webster2's Software
You will need some of the tools provided by NB on the CD that comes with the development kit to download the web server software to your server. Install the development kit on your computer. Also, get the ZIP file containing the Webster2 code from the DDJ website (see www.ddj.com/code/).
First, it is necessary to verify your server is running and available via the network. The easiest way to do this is to bring up the NB IPSetup program. If all is well you should see a MOD5270 device listed in the right pane and see the networking parameters your server has adopted in the left. If you don't see your server, make sure the server is plugged in, the 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.
// Webster2 Configuration File - Version: 1.1 // NOTES: // 1. Case is significant // 2. No blank lines allowed; Use // for comment lines and formatting // 3. Be careful with spaces around usernames and passwords // 4. Don't use tabs // Realm Name: Your website's Name Hostname: YourHostname Use DHCP: yes // Use Authentication: no 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 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, I wanted to have some form of logging so I could see when and by whom my website was accessed. My first inclination was to use a log file in the filesystem, but I 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, I decided to log across the network to another machine. I 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, I turn Webster2's access LED off/on. This causes the LED to flash whenever my website is accessed.
Finally, if you want to modify and/or extend the Webster2's web server software I 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 earn you some serious bragging rights with your high-tech buddies.