16 July 2001 John Bijnens is a CAM/CAM engineer in the KHLim - Dep. IWT which is some kind of technical university in Belgium. He gives training in Pro/E and also writes CNC postprocessors (all development is done on OS/2.) If you have a comment about the content of this article, please feel free to vent in the OS/2 eZine discussion forums. There is also a Printer Friendly version of this page. |
|
WEB/2
When we talk about a web server on an OS/2 system, most people
automatically think about Apache/2 or Lotus Domino GoWebserver.
Lotus Domino GoWebserver is a beautiful web server that comes
with Warp Server for eBusiness, is native OS/2, but as far as I
know is sadly discontinued by IBM.
| ||||||||||||||||||||||||||||||
How to install Web/2Installation is very easy. Download three packages from dink.org
You can also unzip the file sample.zip It contains some cgi-examples. How to configure Web/2General settings : web.cfgFirst of all start setup.exe. This creates some additional configuration files like alias.cfg, mime.cfg, and cgi.cfg and allows you to specify some general settings.
Web Port This is the TCP/IP port the Web/2 server will be listening to. You don't need to change this as 80 is the standard port for the http protocol. Logging If this is on, Web/2 will create a log file 'web.log' that contains a listing of every web server access. This log file can be used to check who has accessed your server and see what they've been looking at. Logfile Style With this setting you can specify the format of the log file. You have two options :
If you want to switch between these formats, e.g. from web/2 to ncsa/apache because you want to use a log analyzer, you have to start a new log. You can do this by renaming the old log. Resolve ip's this enables host name lookup. This means that the IP-address of every computer that accesses the web server will be looked up through the name server. So instead of seeing 193.190.57.4 as the name of the user accessing the web server, you will see voyager. This option comes in very handy when you want to have the log analyzers generate an overview of the domains your visitors come from. If you don't need this, you can turn this option off to avoid the overhead of consulting the name server with every web server access. send() Blocksize This option allows you to adjust the size of the blocks that the web server sends. You probably don't want to play with this. File-list if no index.html With this option you can allow/disallow the web server to send a list of the files in the requested directory if there is no index.html present in this directory. This is known as directory browsing and for security reasons it might be a good idea to disable this option. Main HTML directory The name of this option speaks for itself. This doesn't necessarily need to be the directory where the HTML pages of you web site are located. CGI-BIN directory This is the directory where your cgi scripts must reside in order to get executed. File-list icons directory This is the directory where the icons reside that are used for the representation of the file list when you have enabled "File-list if no index.html" and no file index.html is present in the requested directory. When you exit setup.exe all settings are written in the configuration file web.cfg If Web/2 is running while you are changing these general settings you have to restart it to activate the new settings. Example of the native Web/2 formatConnection From: voyager @ Jul 9, 2001 3:04pm Browser: Mozilla/4.61 [en] (OS/2; U) Sending: index.htm Connection From: voyager @ Jul 9, 2001 3:04pm Browser: Mozilla/4.61 [en] (OS/2; U) Referer: http://193.190.57.1/ Sending: powerd.gif Connection From: 192.168.1.62 @ Jul 9, 2001 3:04pm Browser: Mozilla/4.61 [en] (OS/2; U) Sending: index.htm Example of the NCSA/Apache compatible formatvoyager - - [09/Jul/2001:15:13:21 +0000] "GET / HTTP/1.0" 200 454 "" "Mozilla/4.61 [en] (OS/2; U)" voyager - - [09/Jul/2001:15:13:21 +0000] "GET /powerd.gif HTTP/1.0" 200 2215 "http://193.190.57.1/" "Mozilla/4.61 [en] (OS/2; U)" Example of a File listingThe icons that are used in this representation are the ones found in the directory specified with the option File-list icons directory. You can create your own icons to customize the look according to your own wishes. Connection time in windowIn the image below you can see the window of Web/2 where the date and time of the last web server access are given.
Specifying aliases and virtual domains : alias.cfgWeb/2 allows you to create aliases and virtual domains with separate log files.Contents of a alias.cfgindex.htm index.html e:\WebSite_CelKunststoffen virtual:celkunststoffen.khlim.be log:celkunststoffen.log d:\users\jimmy\Kwaliteitssysteem virtual:Kwaliteit log:kwaliteit.log e:\testdrive\html\stat.html stat.htm c:\os2\utils /os2utils/ index.htm index.html Aliases allow you to have the web server serve up one file instead of another, so for example, every time someone tries to access index.html Web/2 will redirect this request and send instead the file index.htm So if you have two different files index.html and index.htm only index.htm gets opened. If you don't want this behavior and want both index.html and index.htm to be able to get opend you have to delete this entry. Virtual hosts allow a single web server to provide web serving services to more than one domain. To create a virtual host celkunststoffen.khlim.be add the line: e:\WebSite_CelKunststoffen virtual:celkunststoffen.khlim.be log:celkunststoffen.log When someone visits http://celkunststoffen.khlim.be the file index.htm that's present in the directory e:\WebSite_CelKunststoffen will get opened. Every access to this site is logged in a file celkunststoffen.log that will be created in the directory Web/2 is installed in. You can assign multiple hosts to the same IP-address. This way you can have multiple web sites on the same IP-address. Be aware of the fact that all the domain names you use (celkunststoffen.khlim.be, ...), must be registered at a name server. Otherwise they can't be accessed. Web/2 offers you the possibility of creating aliases for html files and directories. Suppose the IP-address of the computer Web/2 is running on is 193.190.57.4 e:\testdrive\html\stat.html stat.htm c:\os2\utils /os2utils/ When a visitor accesses the URL http://193.190.57.4/stat.htm you expect that the web server will send the file stat.htm that's located in the main HTML directory. Instead the server will send the file e:\testdrive\html\stat.html When a visitor accesses the URL http://193.190.57.4/os2utils/ you expect that the web server will send the file index.htm (if it is present) that's located in the directory /os2utils/ that can be found in the main HTML directory, or in case there is no index.htm, the file listing of that directory is shown. Instead the server will redirect /os2utils/ to c:\os2utils Specifying mime types and extensions : mime.cfgOne of the configuration files that's generated after running setup.exe is mime.cfg This file holds all the mime types and extensions that are known to Web/2. This is normally used by the Web/2 server to make it possible for web browsers like Netscape to recognize the correct file type. When you don't do anything extraordinary it isn't necessary to edit this file.Specifying cgi command extensions : cgi.cfgOne of the configuration files that's also generated after running setup.exe is cgi.cfg. This file holds all the extensions of the executables, rexx files, perl scripts, etc. that are allowed to run as a cgi file.When creating cgi files for use with Web/2 keep in mind that
Contents of the standard cgi.cfginternal .exe .cmd .cgi !php.exe .php .phtml .php3 .php4 perl.exe .pl .perl Some very nice SSI tagsSSI stands for Server Side Includes. These are tags that are interpreted by the web server itself before sending the file to the browser of the visitor to your site.
There is an example file stat.htm in the directory html that can be used an example on how to use SSI tags. Contents of stat.htm<html><head><title>web/2 statistik page</title></head> <br> your host / ip: <host> <ip><br> your browser: <browser><br> your referer: <referer><br> web/2 version: <webversion><br> web/2 blocksize: <blocksize><br> os/2 uptime: <sysuptime><br> web/2 uptime: <web2uptime><br> connections: <connections><br> date/time: <date> <time><br> </html> Output of stat.htm when accessed through a link on another HTML-page your host / ip: merlin 127.0.0.1
If you want to show how many times a page is accessed by using the SSI tag <textcounter> you must make an entry for this page in the file counter.dat that can be found in the directory Web/2 is installed in. Suppose you have a file f:\index.htm and you want to make a counter for this page. Somewhere in this page you have something like This page has been accessed Now make the following entry in the file counter.dat
This page has been accessed 5 times.
and you see that the line you've entered in counter.dat has changed to
Dink (the author's nickname) has programmed some other fine
software packages. The most known is probably z! a very fine
MP3 player which can be also be used as a helper application in
Netscape in order to play MP3 streams.
You can contact the author at
http://dink.org/email
Don't forget that all this software is written by the author in
his own spare time so if you like this software, please send a
sign of life and your appreciation to him. This way he knows his
work is valued very much and it will give a stimulation to
develop new versions.
If anything isn't working as expected don't start to yell,
try to provide the author with a full reproducible error report
so he is able to correct the problem in case of a bug.
|
||||||||||||||||||||||||||||||||
|