home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / gosrv250.zip / gohttp.doc < prev    next >
Text File  |  1997-02-07  |  12KB  |  253 lines

  1.                                                                GoServe 2.50
  2. How to start using GoServe as a Web server
  3. """"""""""""""""""""""""""""""""""""""""""
  4.  
  5. Copyright (c) IBM Corporation, 1994, 1997.  All rights reserved.
  6.  
  7.  
  8. Introduction
  9. """"""""""""
  10. 'GoServe' is a multi-purpose server for OS/2, which supports the
  11. HyperText Transfer Protocol (HTTP), used by the World-Wide Web (often
  12. known as 'the Web' or 'WWW').
  13.  
  14. Providing that you already have TCP/IP installed and started, GoServe
  15. can be running and serving documents and other files across a network in
  16. minutes.  There are no configuration files to be edited first.
  17.  
  18. This document describes how to use GoServe as a Web server, and includes
  19. instructions on how to set up your own home page.  GOHTTP.ZIP includes a
  20. working home page and customization filter, together with several other
  21. sample pages.  The GoServe Web documentation is also included, linked to
  22. the sample home page.
  23.  
  24. Note: It is assumed that you have some familiarity with the Web, and
  25. have (and know how to use) a Web client, such as Web Explorer.
  26.  
  27.  
  28. Quick start
  29. """""""""""
  30. Assuming you have unzipped GOSERV.ZIP into the directory of your choice
  31. (for example, D:\GOSERVE), then:
  32.  
  33.   1. Open an OS/2 window
  34.  
  35.   2. Unzip the included file GOHTTP.ZIP to a different directory.  To
  36.      use the default setup, put this 'data directory' on the same drive
  37.      as the first directory, and call it GOHTTP (for example, D:\GOHTTP).
  38.  
  39.   3. Change your current directory back to the GoServe directory (for
  40.      example, D:\GOSERVE)
  41.  
  42.   4. Start GoServe with the parameter "http", for example using:
  43.  
  44.        start goserve http
  45.  
  46. You should then see a GoServe window (titled 'GoServe [HTTP]') appear.
  47. If there are no error messages, the server is now active, and you should
  48. be able to connect to the sample pages with any Web browser (available
  49. as a separate program).  For example, if the name of your machine is
  50. "fred.hursley.ibm.com" (use the "hostname" command, while connected to
  51. your network, to find it out if you don't know it) then specifying a URL
  52. of "http://fred.hursley.ibm.com/" should display the sample home page.
  53.  
  54. --- Setting up an icon for GoServe ---
  55.  
  56. To set up an icon (program reference object) for a GoServe Web server
  57. and (optionally) ensure that GoServe is started automatically when OS/2
  58. is booted:
  59.  
  60.   1. With your current directory being the GoServe directory (for
  61.      example, D:\GOSERVE), run the command:
  62.  
  63.        makeicon http
  64.  
  65.      This should make an icon called 'GoServe - Web' appear on the
  66.      Desktop.  You can Move or drag it to another folder if you wish.
  67.      The server can now be started by clicking on the new icon (you may
  68.      want to check that this works).
  69.  
  70.   2. Open the Startup folder (this may be on the Desktop or in the 'OS/2
  71.      System' folder).
  72.  
  73.   3. Make a shadow of the GoServe icon in the Startup folder.  To do
  74.      this, hold down the Ctrl+Shift keys and then drag the icon to the
  75.      Startup folder, drop it, and release Ctrl+Shift.  (See the OS/2
  76.      documentation if you need more details.)
  77.  
  78. With the shadow in the Startup folder, the server will be started
  79. automatically whenever OS/2 is booted or rebooted.
  80.  
  81.  
  82. Your own home page
  83. """"""""""""""""""
  84. The sample filter can be used to serve files such as HTML documents,
  85. images, and so on, without any changes or programming.  All you need to
  86. do is change the data files.
  87.  
  88. Here's what you need to do to set up your own 'home page', given that
  89. the sample page above works:
  90.  
  91.   1. Make a new directory for your own World-Wide Web data (for example,
  92.      called D:\WWWHOME).
  93.  
  94.   2. Copy the file D:\GOHTTP\INDEX.HTM to your new directory, and modify
  95.      it to make your 'home page'.  To start with, to see if it works,
  96.      it's probably best to change a few words only.  For example, change
  97.      the line
  98.  
  99.        Welcome to this sample home page.
  100.  
  101.      to something different.
  102.  
  103.      If you leave any references in it to any of the other sample files,
  104.      you'll need to copy those over, too, for the links to work.
  105.  
  106.   3. If GoServe is not already running, start it as before (don't forget
  107.      the 'HTTP' parameter, if starting from a command prompt).
  108.  
  109.      Choose 'Directory selection' from the 'Options' menu, and use the
  110.      dialog there to change the data directory to be your new directory
  111.      (for example, to D:\WWWHOME).
  112.  
  113.   4. Try your favourite WWW client, connecting to your machine as before,
  114.      and it should now display your new home page.
  115.  
  116.   5. All you have to do now is modify the home page to your liking.
  117.      Most of the tags needed (<h1> indicates Header level 1, etc.) are
  118.      quite simple to use, but you'll probably want to find an
  119.      introduction to the tag language (HTML, the HyperText Markup
  120.      Language).  A good place to start is the Web "home" at CERN:
  121.      http://info.cern.ch/
  122.  
  123. All of the details above can be customized if you wish, but you will
  124. probably need to learn more about GoServe and Rexx to change things
  125. effectively.  Please see GOSERVE.DOC for more information.
  126.  
  127. This document, the latest GoServe package, and other relevant links,
  128. information, and programs are available at the GoServe Web page at
  129. http://www2.hursley.ibm.com/goserve/
  130.  
  131.  
  132. An overview on how GoServe works
  133. """"""""""""""""""""""""""""""""
  134. (To make sense of this, you may need to read GOSERVE.DOC too.)
  135.  
  136. Whenever a client connects to your machine, it sends a 'request string'.
  137. GoServe receives the string and passes it to a 'filter'.  This filter (a
  138. program, written in Rexx) checks that the request is valid, and normally
  139. responds with a file (such as an HTML document or a GIF image file).  It
  140. is the filter's responsibility to choose or create the file, given the
  141. incoming request string.
  142.  
  143. A sample filter (GoFilter.80) is provided--see commentary in that
  144. program for details.  In brief, it asks the server for the name of the
  145. data directory, checks for certain errors, and then processes the
  146. request according to the verb (method) specified in the request.
  147.  
  148. Notes:
  149.  
  150.   1. The sample filter gets the root, or home, directory for the data it
  151.      is to serve by calling the DATADIR() function.  The value this
  152.      returns is set by GoServe (which, in turn, is derived from the
  153.      GoServe startup parameter or the Directory Selection dialog).
  154.  
  155.   2. Only the most common verbs are handled by the sample filter:
  156.  
  157.        o GET is the most common ('send me some data') request.  In most
  158.          cases, this sends back a file to the client, using the GoServe
  159.          FILE command.
  160.  
  161.        o HEAD is the same as GET, except that the data are not sent back
  162.          to the client.  GoServe automatically ensures that only
  163.          'header' lines, which describe the data, are sent.  HTTP
  164.          requires that all servers handle both GET and HEAD verbs.
  165.  
  166.        o POST is used by a client when data are to be sent to the server
  167.          (for example, text filled in for a Form, or a "post" to a
  168.          newsgroup).  When the data is known to be short (fewer than 250
  169.          characters), GET may be used instead; the specification of
  170.          which method to use is included in the <form ...> tag of the
  171.          source document.
  172.  
  173.   3. A default document is provided if none is specified.
  174.      Conventionally, this is called 'index.htm' or 'index.html'; a
  175.      sample 'index.htm' is provided (you can rename this to 'index.html'
  176.      if you are using an HPFS disk).
  177.  
  178.   4. The TYPE option, where specified on a FILE response, indicates that
  179.      the server should prefix an HTTP 'OK' response and header to the
  180.      beginning of the file returned.  The TYPE option is followed by the
  181.      MIME type (e.g., text/html or image/gif) of the file being
  182.      returned.  Web servers should normally always specify a TYPE on a
  183.      FILE command.
  184.  
  185.   5. Requests should be specified in URI form in that forward slashes
  186.      should be used instead of backslashes to indicate directories.  For
  187.      example, with the sample setup, the tag <a href="fred/%7Edata.htm">
  188.      would cause the filter to receive the URI '/fred/%7Edata.htm'.  The
  189.      packed URI (third argument string) would then be 'fred/~data.htm'.
  190.      The filter then prefixes the home directory name, resulting in a
  191.      file specification such as 'd:/gohttp/fred/~data.htm'.  This would
  192.      refer to the OS/2 file 'd:\gohttp\fred\~data.htm'.  GoServe
  193.      (actually the OS/2 I/O routines) will make the appropriate '/' to
  194.      '\' adjustments.
  195.  
  196.   6. Errors are signalled to the client by sending back files that start
  197.      with the appropriate HTTP header line; these are generated by an
  198.      internal subroutine, which can be modified for more detailed or
  199.      personal error messages.  This subroutine could be made external if
  200.      the TEMPFILE value is passed as an argument when it is called.
  201.  
  202.   7. The sample 'globemap' routine shows how the coordinates of a click
  203.      on an active image can be processed.  This particular routine
  204.      returns the coordinates as a percentage of half the image size,
  205.      relative to the middle and with map-style coordinates (X is
  206.      positive to the East, Y is positive to the North).
  207.  
  208.   8. Certain special 'test and control' requests are supported by the
  209.      sample filter (for example, return server statistics).  In the
  210.      sample filter, these are only allowed from a client with the same
  211.      address as the server.  Other possibilities include allowing 'ANY'
  212.      as the allowed name [so anyone can use them], or, conversely, using
  213.      a privately-selected URL for the controls--which would act as a
  214.      password.  See GOSERVE.DOC for more information on control options.
  215.  
  216.   9. HTTP defines a simple 'basic' access control mechanism, and an
  217.      example of using this is included in the filter and sample pages.
  218.      When used, the person using the browser is prompted for a userid
  219.      and password; the filter checks the validity of this.
  220.  
  221.  
  222. Data organization and setup
  223. """""""""""""""""""""""""""
  224. It is recommended that the control and execution files be placed in a
  225. directory separate from your data, perhaps called GOSERVE.  This may be
  226. the same directory as is already being used for running a Gopher server,
  227. as the control files (Filter, audit files, etc.) will normally have a
  228. different extension (.80).
  229.  
  230. Note that the filter must be in the working directory for GoServe,
  231. though you may change its name (an extension matching the port is
  232. recommended).  If you make changes to the default filter, it's a good
  233. idea to change its name, too, so if you install a new version of GoServe
  234. your filter will not be overwritten by the new default filter.
  235.  
  236. The sample filter assumes that the data are held in a tree starting at
  237. the directory known by GoServe as the data directory (by default,
  238. GoServe assumes that is the directory '\gohttp' on the same drive as the
  239. working directory).  You should normally change this, using GoServe, to
  240. point to a different subdirectory tree that holds your own data.  This
  241. tree can be on any drive and start at any depth (it may even start at
  242. the root directory of a disk).
  243.  
  244. Note that the sample filter allows unrestricted access to all files in
  245. the subtree starting at your data directory.
  246.  
  247. For more details, see GOSERVE.DOC.
  248.  
  249. - - - - -
  250.  
  251. Mike Cowlishaw, IBM UK Laboratories
  252. mfc@vnet.ibm.com
  253.