|Setting up a WWW server||- by Jorge Martins|
Why would you want to do it?
Why would you want to set up a WWW server under OS/2? Well, you might want to do it just for fun! You might be a programmer needing a server to test your client software on, or you could have a specific need to share information on a heterogeneous workgroup. In my case, as an instructor, I wanted to eliminate the use of paper in the class.
Which server should you use?
There are several Hyper Text Transfer Protocol (HTTP) servers available for OS/2, such as the Apache web server. However, I chose GoServe for OS/2, on which this article focuses, because I had no need for more than minimal security. GoServe is fast, small, written specifically for OS/2, multithreaded, REXX driven and I must confess, I really admire its author, Mike Cowlishaw. He's the IBM Fellow that designed the REXX language and NetREXX, a blend of Java and REXX.
Your specific needs may be different, so I encourage you to try other servers. If you
also use Linux, the Apache web server would be a logical choice. In any case, GoServe might suit your needs and it is very easy to set up.
GoServe is distributed as a 328 KB zip file, so after a very fast download, installation is even faster. You just have to unzip it into a directory of your choice (e.g. c:\goserve) and GoServe is ready to run! It really is that simple. Installation doesn't even require a reboot.
With just this procedure though, you would have to start GoServe from the command line. Typing makeicon http invokes a REXX script that will create a program object on the Desktop that starts GoServe as a web server. You can then shadow this object to the Startup folder and have GoServe automatically started every time you boot your computer.
(GoServe can also act as a Gopher server: you can alternatively type makeicon gopher and the same script will create an object invoking GoServe as a gopher server.)
At this point, however, there is nothing to be served; we haven't created any HTML documents. Fear not! In the GoServe directory, there is a file named gohttp.zip. Unzip this file to a separate directory (for organizational purposes), such as c:\goserve\sample (e.g. unzip gohttp -d c:\goserve\sample). The file you just unzipped contains a sample home page.
Double clicking on the GoServe icon brings up the main window (GIF, 3.5k). Now we have to configure it to serve our sample pages. The Options menu calls a configuration Notebook (GIF, 10.2k). On the DataDir page, enter the name of the directory where you unzipped the sample pages. Notice how GoServe reds out invalid directories as you type. Hit the apply button and you're done.
OK, now it's time to try it out. Open your favorite web browser and point it to your own machine using a dotted decimal notation (e.g. http://184.108.40.206/ -- you can get this IP address from your Internet dialer) or your host name if you have either a Domain Name Server (DNS) in your network or a properly configured HOSTS file.
Incidentally, the sample pages provided also serve as a tutorial on GoServe. There are samples of image maps and forms. There's even a password check sample. (GoServe, however, is not secure and a determined hacker could gain access to sensitive data, so beware.)
Creating your own pages
Now that GoServe is properly installed, you may as well create your own pages. As you might expect, this is also a very easy task. Create a directory anywhere you want, and with your favorite editor (I use EPM with the HTML extensions) create a file named index.htm in this directory. Go to the DataDir tab in the configuration notebook and change the directory to the one you just created.
That's it, GoServe only expects you to have a file with a specific name (index.htm) in the
data directory, all the other pages are linked directly or indirectly to this one, and so on...
For quite some time, I ran GoServe on an OS/2 Warp Connect machine actively serving 10 clients, and I must say, the impact on performance was minimal. One of the factors that leads to this lightweightedness is the extensive use of threads. GoServe, unlike most HTTP servers that were born on UNIX, uses threads to handle incoming connections instead of "forking" new processes, thus reducing the working set.
While running, a graphical display of activity is shown, so you can monitor the number of transactions and response times. Many options can be set to enable GoServe to meet a required minimum response time, such as the maximum number of concurrent connections. Mike Cowlishaw goes as far as advising users to minimize the main window so that draw operations don't slow GoServe down.
By default, HTTP servers and web browsers use port 80 to communicate; this is also the case with GoServe. It is, however, possible to run GoServe using a different port or even several instances on different ports, all on the same machine.
The REXX Filter
At the heart of GoServe operation is the REXX filter. This is a REXX program called every time GoServe accepts an incoming connection. I don't think there could be a more configurable approach to a web server. This filter determines which page is to be sent, how to handle forms, what is to be sent to the client if the requested page does not exist and so on. The REXX filter approach also has the nice side effect that it is dead easy to interface with DB2/2 databases.
This flexibility doesn't come without a price, though. Bigger filters perform sluggishly and there's no built-in support for CGI. This has been remedied by alternate filters (available on the 'net) that simulate CGI capabilities and provide other niceties such as multi-homed servers.
GoServe, by default, operates very smoothly, but when needed, many options can be set such as:
GoServe also provides strong remote control capabilities along with sample demonstration pages. Using a very extensive command set, it is possible to change the filter, data directory, various limits, reset the counts, etc. You can also view several statistics and archive the audit file.
- Various limits
- Various time-outs
After moving the GoServe server to a Warp Server dedicated machine I have yet to experience one single problem with it. I've had uptimes dictated only by hardware maintenance. Warp Server helps here too!
If you like GoServe and use it, I recommend reading the documentation thoroughly. The REXX filter allows tremendous versatility. Also be sure to visit the GoServe web site, where you can find other REXX filters. There's even a mailing list. (See the GoServe home page for details on how to subscribe it.)
GoServe is very easy to set up. It's very fast, versatile, lightweight, multithreaded, REXX enabled -- and it's FREE! It is a fine example of a properly written OS/2 PM application and a great demonstration of the applicability of the REXX language. It doesn't offer some advanced capabilities found in other products such as secure transactions, nor does it support CGI without some tweaking but it succeeds graciously at what it attempts to do.
Note: GoServe is distributed under the IBM Employee Written Software program (EWS).
by Mike Cowlishaw (IBM EWS)
download from the GoServe Home Page (ZIP, 328k)
Jorge Martins is a Mathematics/Computer Science student at Azores University in Azores, Portugal. He is also a C/C++ instructor at CFPA, an Azorean Training Center. He has used and programmed OS/2 since version 1.0.
[Our Sponsor: Keller Group Inc. - Developers of FaxWorks for OS/2 and PMfax.]
This page is maintained by Falcon Networking. We welcome your suggestions.
Copyright © 1997 - Falcon Networking