Project 1: Web Server

Introduction:
In order to be able to access data over the Internet, we will need a web server running on our PC.  A web server responds to requests from a web browser (like Internet Explorer) and serves web pages to the browser for you to view.   The web server will run continuously in the background on your PC, waiting for requests to come in over your home network or the Internet.

The ideal web server will be easy to install and use, and not require a lot of system resources.   There are a lot of free web servers out there and most of them could probably be made to work.  But the one chosen for Free Data Logging is called Tiny Web Server.

Getting Tiny Web Server
First thing to do is to create a new folder on your C: drive to hold the Free Data Logger files and projects.  Simply use Windows Explorer to create a folder as follows:  C:\freelogger

When the new folder has been created you are ready to download and  install the web server.

Tiny Web Server is available for download here.  Simply click on the download link and save the file to the C:\freelogger folder you just created. At the end of the download process you will have TinyWebServer.zip located in C:\freelogger.

Installing the Web Server
Now unzip the TinyWebServer.zip file using WinZip or some other suitable extraction utility.  This will produce a single file: Webserver.exe.

Before we can run Tiny Web Server, we must create three web pages and place them in the C:\freelogger folder.  These pages are:

    index.html – the “home page” of the web server
    error.html – the page displayed when there is an error
    forbidden.html – shown when a browser asks for a blocked web page

Creating the Web Pages
You can quickly make the three required web pages using the Notepad accessory in Windows. If you know a little HTML code you will recognize the symbols shown on the sample pages below. If not, simply type the text – exactly as you see it – into Notepad and save them (use ANSI Encoding) with the appropriate file names in the C:\freelogger folder.

Tiny Web Server Index page

Tiny Web Server Error Page

Tiny Web Server Forbidden page

If you don’t want to type all of this into Notepad, you can copy the text from the page found here.  Copy just the html code and not the comment (#) lines.  Be sure to save to C:\freelogger\ using ANSI encoding.  Save each page separately as index.html, error.html, etc.

Configuring Tiny Web Server
Now launch the TinyWebServer.exe file.  It may complain that it can’t find the index, error or forbidden pages you just made, but keep clicking until you get to the configuration screen, as seen below:

Tiny Web Server Configuration screen 1

Enter the C:\freelogger path into the Home Directory box.  This tells Tiny Web Server where to find your web pages.  I also clicked the file browsing box (lets you view text and data files through your browser). 

The default settings on the other configuration tabs should be OK.  You will have to check the Agree box on the Disclaimer tab.

When the configurations have been set, save them using the Settings drop down menu and select Keep.  The configuration screen should go away and you will see the Tiny Web Server icon in the tray at the bottom right of your desktop.  You can right-click  the icon at any time to bring up the Tiny Web Server configuration window.

Note that the Help instructions for Tiny Web Server are located on the Server tab.  The documentation is on-line.

Testing Tiny Web Server
If everything is configured correctly and Tiny Web Server is running, open your browser and type the following into the address box:

http://localhost/index.html

You should see the Tiny Web Server index page you just created:

Tiny Web Server home page in browser

Congratulations! You now have a small web server running on your PC. To close down Tiny Web Server, right-click on the tray icon to bring up the configuration window. Then click on the Server drop-down and selec Exit.

Going Further
If you know how to make web pages using HTML code, you can add these to the C:\freelogger folder and view them with Tiny Web Server. You can view the Tiny Server home page from other PCs on your home network – just type in the IP address of the PC running Tiny Server:

http://192.168.0.123/index.html

Where 192.168.0.123 is the IP address of your Tiny Web Server PC. This is how we will view data in a browser remotely – by viewing web pages served up by Tiny Web Server.

Advertisements
%d bloggers like this: