home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / CONTRIB / HTTPD / HTTPD_AS.TAR / ascii / tutorials.txt < prev    next >
Encoding:
Text File  |  1994-10-11  |  30.7 KB  |  809 lines

  1. NCSA httpd tutorials
  2.  
  3. In an effort to make this documentation a bit more usable, we have written these
  4. tutorials on various aspects of server setup. 
  5.  
  6.    NCSA httpd directory indexing
  7.  
  8.    NCSA httpd provides a directory indexing format which is similar to that
  9.    which will be offered by the WWW Common Library. To set up this
  10.    indexing, follow these steps.
  11.  
  12.    For an example of what these indexes look like, take a look at the demo.
  13.  
  14.    Activating Fancy indexing
  15.  
  16.    You first need to tell httpd to use the advanced indexing instead of the simple
  17.    version. The simple version should be used if you prefer its simplicity, or if
  18.    you are serving files off of a remote file server, for which the stat() call
  19.    would be costly. You tell the server which you want to use with either the
  20.    IndexOptions directive, or the older FancyIndexing directive. We recommend:
  21.  
  22.    IndexOptions FancyIndexing
  23.  
  24.    Icons
  25.  
  26.    NCSA httpd comes with a number of icons in the /icons subdirectory which
  27.    are used for directory indexing. The first thing you should do is make sure
  28.    your Server Resource Map h as the following line in it:
  29.  
  30.    Alias /icons/ /usr/local/etc/httpd/icons/
  31.  
  32.    You should replace /usr/local/etc/httpd/ with whatever you set
  33.    ServerRoot to be. 
  34.  
  35.    Next, you need to tell the server what icons to provide for different types of
  36.    files. You do this with the AddIcon and AddIconByType directives. We
  37.    recommend something like the following setup:
  38.  
  39.    AddIconByType (IMG,/icons/image.xbm) image/*
  40.    AddIconByType (SND,/icons/sound.xbm) audio/*
  41.    AddIconByType (TXT,/icons/text.xbm) text/*
  42.  
  43.    This covers the three main types of files. If you want to add your own icons,
  44.    simply create the appropriately sized xbm, place it in /icons, and choose a
  45.    3-letter ALT identifier for the type.
  46.  
  47.    httpd also requires three special icons, one for directories, one which is a
  48.    blank icon the same size as the other icons, and one which specifies the parent
  49.    directory of this index. To use the icons in the distribution, use the following
  50.    lines in srm.conf:
  51.  
  52.    AddIcon /icons/menu.xbm ^^DIRECTORY^^
  53.    AddIcon /icons/blank.xbm ^^BLANKICON^^
  54.    AddIcon /icons/back.xbm ..
  55.  
  56.    However, not all files fit one of these types. To provide a general icon for any
  57.    unknown files, use the DefaultIcon directive:
  58.  
  59.    DefaultIcon /icons/unknown.xbm
  60.  
  61.    Descriptions
  62.  
  63.    If you want to add descriptions to your files, use the AddDescription
  64.    directive. For instance, to add the description "My pictures" to 
  65.    /usr6/rob/public_html/images, use the following line:
  66.  
  67.    AddDescription "My pictures" /usr6/rob/public_html/images/* 
  68.  
  69.    If you want to have the titles of your HTML documents displayed for their
  70.    descriptions, use the IndexOptions directive to activate ScanHTMLTitles:
  71.  
  72.    IndexOptions FancyIndexing ScanHTMLTitles
  73.  
  74.    WARNING: You should only use this option if your server has time to spare!!!
  75.    This is a costly operation!
  76.  
  77.    Ignoring certain items
  78.  
  79.    Generally, you don't want httpd sending references to certain files when it's
  80.    creating indexes. Such files are emacs autosave and backup files, httpd's
  81.    .htaccess files, and perhaps any file beginning with . (if you have a gopher or
  82.    FTP server running in that directory as well). We recommend you ignore the
  83.    following patterns:
  84.  
  85.    IndexIgnore */.??* */README* */HEADER*
  86.  
  87.    This tells httpd to ignore any file beginning with ., and any file starting with
  88.    README or HEADER.
  89.  
  90.    Creating READMEs and HEADERs
  91.  
  92.    When httpd is indexing a directory, it will look for two things and insert them
  93.    into the index: A header, and a README. Generally, the header contains an
  94.    HTML <H1> tag with a title for this index, and a brief description of what's
  95.    in this directory. The README contains things you may want people to read
  96.    about the items being served. 
  97.  
  98.    httpd will look for both plaintext and HTML versions of HEADERs or
  99.    READMEs. If we add the following lines to srm.conf:
  100.  
  101.    ReadmeName README
  102.    HeaderName HEADER
  103.  
  104.    When httpd is indexing a directory, it will first look for HEADER.html. If it
  105.    doesn't find that file, it will look for HEADER. If it finds neither, it will
  106.    generate its own. If it finds one, it will insert it at the beginning of the index.
  107.    Similarly, the server will look for README.html, then README to insert a
  108.    trailer for the document. 
  109.  
  110.  
  111.  
  112.    Setting up CGI in NCSA httpd
  113.  
  114.    CGI scripts are a way for documents to be generated on the fly. You should
  115.    first read the brief introduction to CGI to learn what it is and why you would
  116.    want to use it.
  117.  
  118.    There are two main mechanisms to tell NCSA httpd where your scripts are.
  119.    Each has its pluses and its minuses.
  120.  
  121.    ScriptAlias
  122.  
  123.    The first approach is based on the Server Resource Map directive ScriptAlias.
  124.    With this directive, you specify to the server that you want to designate a
  125.    directory (or directories) as script-only, that is, any time the server tries to
  126.    retrieve a file from these directories it will execute the file instead of reading
  127.    it.
  128.  
  129.    The usual setup is to have the following line in srm.conf:
  130.  
  131.    ScriptAlias /cgi-bin/ cgi-bin/
  132.  
  133.    This will make any request to the server which begins with /cgi-bin/ be
  134.    fulfilled by executing the corresponding program in ServerRoot/cgi-bin/. 
  135.  
  136.    You may have more than one ScriptAlias directive in srm.conf to desingnate
  137.    different directories as CGI.
  138.  
  139.    The advantage of this setup is ease of administration, and centralization.
  140.    Many system managers don't want things as dangerous as scripts anywhere in
  141.    the filesystem. The disadvantage is that anyone wishing to create scripts must
  142.    either have their own entry in srm.conf or must have write access to a
  143.    ScriptAliased directory. 
  144.  
  145.    CGI as files
  146.  
  147.    NCSA httpd 1.2 allows you to create CGI scripts anywhere, by specifying a
  148.    "magic" MIME type for files which tells the server to execute them instead of
  149.    sending them. To accomplish this, use the AddType directive in either the
  150.    Server Resource Map or in a per-directory access control file.
  151.  
  152.    For instance, to make all files ending in .cgi scripts, use the following
  153.    directive:
  154.  
  155.    AddType application/x-httpd-cgi .cgi
  156.  
  157.    Alternatively, you could add .sh and .pl after .cgi to allow automatic
  158.    execution of shell scripts and PERL scripts. Note that you have to have
  159.    Options ExecCGI activated in the directory you create scripts. (you might
  160.    want to read more about directives like Option in the docs for installation).
  161.  
  162.    The advantage of this setup is that scripts may be absolutely anywhere. The
  163.    disadvantage is that scripts may be absolutely anywhere (especially places you
  164.    don't want them to be like users' home directories).
  165.  
  166.  
  167.  
  168.    NCSA httpd server side includes
  169.  
  170.    NCSA httpd allows users to create documents which provide simple
  171.    information to clients on the fly. Such information can include the current
  172.    date, the file's last modification date, and the size or last modification of
  173.    other files. In its more advanced usage, it can provide a powerful interface to
  174.    CGI and /bin/sh programs. 
  175.  
  176.    Issues
  177.  
  178.    Having the server parse documents is a double edged sword. It can be costly
  179.    for heavily loaded servers to perform parsing of files while sending them.
  180.    Further, it can be considered a security risk to have average users executing
  181.    commands as the server's User. If you disable the exec option, this danger is
  182.    mitigated, but the performance issue remains. You should consider these
  183.    items carefully before activating server-side includes on your server.
  184.  
  185.    Setting Up Includes
  186.  
  187.    First, you should decide which directories you want to allow Includes in.
  188.    Most likely this will not include users' home directories or directories you do
  189.    not trust. You should then decide, of the directories you are allowing includes
  190.    in, which directories are safe enough to use exec in. 
  191.  
  192.    For the directories in which you want to fully enable includes, you need to use
  193.    the Options directive to turn on the option Includes. Similarly for the
  194.    directories you want crippled (no exec) includes, you should use the option 
  195.    IncludesNOEXEC. In any directory you want to disable includes, use the
  196.    Options directive without either option.
  197.  
  198.    Next, you need to tell the server what filename extension you are using for the
  199.    parsed files. These files, while very similar to HTML, are not HTML and are
  200.    thus not treated the same. Internally, the server uses the magic MIME type 
  201.    text/x-server-parsed-html to identify parsed documents. It will
  202.    then perform a format conversion to change these files into HTML for the
  203.    client. To tell the server which extension you want to use for parsed files, use
  204.    the AddType directive. For instance:
  205.  
  206.    AddType text/x-server-parsed-html .shtml
  207.  
  208.    This makes any file ending with .shtml a parsed file. Alternatively, if you
  209.    don't care about the performance hit of having all .html files parsed, you
  210.    could use:
  211.  
  212.    AddType text/x-server-parsed-html .html
  213.  
  214.    This would make the server parse all .html files. 
  215.  
  216.    Converting your old INC SRV documents to the new format
  217.  
  218.    You should use the program inc2shtml in the support subdirectory of
  219.    the httpd distribution to translate your documents from httpd 1.1 and earlier
  220.    to the new format. Usage is simple: inc2shtml file.html >
  221.    file.shtml. 
  222.  
  223.    The Include format
  224.  
  225.    All directives to the server are formatted as SGML comments within the
  226.    document. This is in case the document should ever find itself in the client's
  227.    hands unparsed. Each directive has the following format:
  228.  
  229.    <!--#command tag1="value1" tag2="value2" -->
  230.  
  231.    Each command takes different arguments, most only accept one tag at a time.
  232.    Here is a breakdown of the commands and their associated tags:
  233.  
  234.       config
  235.  
  236.       The config directive controls various aspects of the file parsing. There
  237.       are two valid tags:
  238.  
  239.          errmsg controls what message is sent back to the client if an
  240.          error includes while parsing the document. When an error
  241.          occurs, it is logged in the server's error log. 
  242.  
  243.          timefmt gives the server a new format to use when providing
  244.          dates. This is a string compatible with the strftime library
  245.          call under most versions of UNIX. 
  246.  
  247.          sizefmt determines the formatting to be used when
  248.          displaying the size of a file. Valid choices are bytes, for a
  249.          formatted byte count (formatted as 1,234,567), or abbrev for
  250.          an abbreviated version displaying the number of kilobytes or
  251.          megabytes the file occupies.
  252.  
  253.       include
  254.  
  255.       include will insert the text of a document into the parsed document.
  256.       Any included file is subject to the usual access control. This command
  257.       accepts two tags:
  258.  
  259.          virtual gives a virtual path to a document on the server.
  260.          You must access a normal file this way, you cannot access a
  261.          CGI script in this fashion. You can, however, access another
  262.          parsed document. 
  263.  
  264.          file gives a pathname relative to the current directory. ../
  265.          cannot be used in this pathname, nor can absolute paths be used.
  266.          As above, you can send other parsed documents, but you cannot
  267.          send CGI scripts. 
  268.  
  269.       echo prints the value of one of the include variables (defined below).
  270.       Any dates are printed subject to the currently configured timefmt.
  271.       The only valid tag to this command is var, whose value is the name
  272.       of the variable you wish to echo.
  273.  
  274.       fsize prints the size of the specified file. Valid tags are the same as
  275.       with the include command. The resulting format of this command
  276.       is subject to the sizefmt parameter to the config command.
  277.  
  278.       flastmod prints the last modification date of the specified file,
  279.       subject to the formatting preference given by the timefmt parameter
  280.       to config. Valid tags are the same as with the include command.
  281.  
  282.       exec executes a given shell command or CGI script. It must be
  283.       activated to be used. Valid tags are:
  284.  
  285.          cmd will execute the given string using /bin/sh. All of the
  286.          variables defined below are defined, and can be used in the
  287.          command.
  288.  
  289.          cgi will execute the given virtual path to a CGI script and
  290.          include its output. The server does not perform error checking
  291.          to make sure your script didn't output horrible things like a
  292.          GIF, so be careful. It will, however, interpret any URL
  293.          Location: header and translate it into an HTML anchor.
  294.  
  295.    Variables defined for Parsed Documents
  296.  
  297.    A number of variables are made available to parsed documents. In addition to
  298.    the CGI variable set, the following variables are made available:
  299.  
  300.       DOCUMENT_NAME: The current filename.
  301.  
  302.       DOCUMENT_URI: The virtual path to this document (such as
  303.       /~robm/foo.shtml).
  304.  
  305.       QUERY_STRING_UNESCAPED: The unescaped version of any
  306.       search query the client sent, with all shell-special characters escaped
  307.       with \.
  308.  
  309.       DATE_LOCAL: The current date, local time zone. Subject to the 
  310.       timefmt parameter to the config command.
  311.  
  312.       DATE_GMT: Same as DATE_LOCAL but in Greenwich mean time.
  313.  
  314.       LAST_MODIFIED: The last modification date of the current
  315.       document. Subject to timefmt like the others.
  316.  
  317.  
  318.  
  319.    Making your setup more secure
  320.  
  321.    When configuring the access control for your server, you will want to make
  322.    sure you do not give any unauthorized access to anyone. Please follow these
  323.    guidelines to ensure that your server is not compromised. 
  324.  
  325.       A word of caution on DNS based access control and user
  326.       authentication
  327.  
  328.       The access control by hostname and Basic user authentication facilities
  329.       provided by httpd are relatively safe, but not bulletproof. The user
  330.       authentication sends passwords across the network in plaintext,
  331.       making them easily readable. The DNS based access control is only as
  332.       safe as DNS, so you should keep that in mind when using it. Bottom
  333.       line: If it absolutely positively cannot be seen by outside people, you
  334.       probably should not use httpd to protect it.
  335.  
  336.       Disable Server-side includes wherever possible 
  337.  
  338.       Whenever you can, use the Options directive to disable server-side
  339.       includes. At the very least, you should disable the exec feature. Note
  340.       that because the default value of Options is All, you should include an
  341.       Options directive in every Directory cl ause in your global ACF and in
  342.       every .htaccess file you write. 
  343.  
  344.       Use AllowOverride None whe rever possible 
  345.  
  346.       Use this directive to prevent any "untrusted" directories (such as users'
  347.       home directories) from overriding your settings (and thus allowing
  348.       their friends to execute xterms as nobody with a server-side include or
  349.       other such horrors). You also gain a bonus in performance. 
  350.  
  351.       Protect your users' home directories
  352.  
  353.       Protect your users' home directories with Directory directives. If
  354.       your users all have their home directories in one physical location
  355.       (such as /home), then this is easy:
  356.  
  357.       <Directory /home>
  358.       AllowOverride None
  359.       Options Indexes
  360.       </Directory>
  361.  
  362.       If they are not all in one location such as /home, then you should use
  363.       this wildcard pattern to secure them (assuming your UserDir is se t to 
  364.       public_html):
  365.  
  366.       <Directory /*/public_html*>
  367.       AllowOverride None
  368.       Options Indexes
  369.       </Directory>
  370.        
  371.  
  372.       In addition, if you wish to give your users the ability to create
  373.       symbolic links to things only they own, use the Option 
  374.       SymLinksIfOwnerMatch.
  375.  
  376.  
  377.  
  378.    Mosaic User Authentication Tutorial
  379.  
  380.    Introduction
  381.  
  382.    This tutorial surveys the current methods in NCSA Mosaic for X version 2.0
  383.    and NCSA httpd for restricting access to documents. The tutorial also walks
  384.    through setup and use of these methods. 
  385.  
  386.    Mosaic 2.0 and NCSA httpd allow access restriction based on several criteria: 
  387.  
  388.       Username/password-level access authorization. 
  389.       Rejection or acceptance of connections based on Internet address of
  390.       client. 
  391.       A combination of the above two methods. 
  392.    This tutorial is based heavily on work done by Ari Luotonen at CERN and
  393.    Rob McCool at NCSA. In particular, Ari wrote the client-side code currently
  394.    in Mosaic 2.0, and Rob wrote NCSA httpd. 
  395.  
  396.    Getting Started
  397.  
  398.    Before you can explore access authorization, you need to install NCSA httpd
  399.    1.0a5 or later on a Unix machine under your control, or get write access to
  400.    one or more directories in a filespace already being served by NCSA httpd. 
  401.  
  402.    You also need to be running Mosaic for X version 2.0 or later, or another
  403.    browser known to support HTTP/1.0-based authentication. 
  404.  
  405.    Prepared Examples
  406.  
  407.    Following are several examples of the range of access authorization
  408.    capabilities available through Mosaic and NCSA httpd. The examples are
  409.    served from a system at NCSA. 
  410.  
  411.    Simple protection by password. 
  412.  
  413.       This document is accessible only to user fido with password bones.
  414.  
  415.       Important Note: There is no correspondence between usernames and
  416.       passwords on specific Unix systems (e.g. in an /etc/passwd file)
  417.       and usernames and passwords in the authentication schemes we're
  418.       discussing for use in the Web. As illustrated in the examples,
  419.       Web-based authentication uses similar but wholly distinct password
  420.       files; a user need never have an actual account on a given Unix system
  421.       in order to be validated for access to files being served from that
  422.       system and protected with HTTP-based authentication. 
  423.  
  424.    Protection by password; multiple users allowed. 
  425.  
  426.       This document is accessible to user rover with password bacon and
  427.       user jumpy with password kibbles. 
  428.  
  429.    Protection by network domain. 
  430.  
  431.       This document is only accessible to clients running on machines inside
  432.       domain ncsa.uiuc.edu. 
  433.  
  434.       Note for non-NCSA readers: The .htaccess file used in this case is
  435.       as follows: 
  436.  
  437.       AuthUserFile /dev/null
  438.       AuthGroupFile /dev/null
  439.       AuthName ExampleAllowFromNCSA
  440.       AuthType Basic
  441.  
  442.       <Limit GET>
  443.       order deny,allow
  444.       deny from all
  445.       allow from .ncsa.uiuc.edu
  446.       </Limit>
  447.  
  448.    Protection by network domain -- exclusion. 
  449.  
  450.       This document is accessible to clients running on machines anywhere 
  451.       but inside domain ncsa.uiuc.edu. 
  452.  
  453.       Note for NCSA readers: The .htaccess file used in this case is as
  454.       follows: 
  455.  
  456.       AuthUserFile /dev/null
  457.       AuthGroupFile /dev/null
  458.       AuthName ExampleDenyFromNCSA
  459.       AuthType Basic
  460.  
  461.       <Limit GET>
  462.       order allow,deny
  463.       allow from all
  464.       deny from .ncsa.uiuc.edu
  465.       </Limit>
  466.  
  467.    General Information
  468.  
  469.    There are two levels at which authentication can work: per-server and
  470.    per-directory. This tutorial primarily covers per-directory authentication.
  471.    Per-directory authentication means that users with write access to part of the
  472.    filesystem that is being served can control access to their files as they wish.
  473.    They need not have root access on the system or write access to the server's
  474.    primary config files. 
  475.  
  476.    Access control for a given directory is controlled by a file named 
  477.    .htaccess that resides in that directory. The server reads this file on each
  478.    access to a document in that directory (or documents in subdirectories). 
  479.  
  480.    By-Password Authentication: Step By Step
  481.  
  482.    So let's suppose you want to restrict files in a directory called turkey to
  483.    username pumpkin and password pie. Here's what to do: 
  484.  
  485.    Create a file called .htaccess in directory turkey that looks like
  486.    this: 
  487.  
  488.    AuthUserFile /otherdir/.htpasswd
  489.    AuthGroupFile /dev/null
  490.    AuthName ByPassword
  491.    AuthType Basic
  492.  
  493.    <Limit GET>
  494.    require user pumpkin
  495.    </Limit>
  496.  
  497.    Note that the password file will be in another directory (/otherdir). 
  498.  
  499.    Also note that in this case there is no group file, so we specify /dev/null
  500.    (the standard Unix way to say "this file doesn't exist"). 
  501.  
  502.    AuthName can be anything you want. AuthType should always currently
  503.    be Basic. 
  504.  
  505.    Create the password file /otherdir/.htpasswd. 
  506.  
  507.    The easiest way to do this is to use the htpasswd program distributed with
  508.    NCSA httpd. Do this: 
  509.  
  510.    htpasswd -c /otherdir/.htpasswd pumpkin
  511.  
  512.    Type the password -- pie -- twice as instructed. 
  513.  
  514.    Check the resulting file to get a warm feeling of self-satisfaction; it should
  515.    look like this: 
  516.  
  517.    pumpkin:y1ia3tjWkhCK2
  518.  
  519.    That's all. Now try to access a file in directory turkey -- Mosaic should
  520.    demand a username and password, and not give you access to the file if you
  521.    don't enter pumpkin and pie. If you are using a browser that doesn't handle
  522.    authentication, you will not be able to access the document at all. 
  523.  
  524.    How Secure Is It?
  525.  
  526.    The password is passed over the network not encrypted but not as plain text
  527.    -- it is "uuencoded". Anyone watching packet traffic on the network will not
  528.    see the password in the clear, but the password will be easily decoded by
  529.    anyone who happens to catch the right network packet. 
  530.  
  531.    So basically this method of authentication is roughly as safe as telnet
  532.    -style username and password security -- if you trust your machine to be on
  533.    the Internet, open to attempts to telnet in by anyone who wants to try, then
  534.    you have no reason not to trust this method also. 
  535.  
  536.    Multiple Usernames/Passwords
  537.  
  538.    If you want to give access to a directory to more than one username/password
  539.    pair, follow the same steps as for a single username/password with the
  540.    following additions: 
  541.  
  542.    Add additional users to the directory's .htpasswd file. 
  543.  
  544.    Use the htpasswd command without the -c flag to additional users; e.g.: 
  545.  
  546.    htpasswd /otherdir/.htpasswd peanuts
  547.    htpasswd /otherdir/.htpasswd almonds
  548.    htpasswd /otherdir/.htpasswd walnuts
  549.  
  550.    Create a group file. 
  551.  
  552.    Call it /otherdir/.htgroup and have it look something like this: 
  553.  
  554.    my-users: pumpkin peanuts almonds walnuts
  555.  
  556.    ... where pumpkin, peanuts, almonds, and walnuts are the
  557.    usernames. 
  558.  
  559.    Then modify the .htaccess file in the directory to look like this: 
  560.  
  561.    AuthUserFile /otherdir/.htpasswd
  562.    AuthGroupFile /otherdir/.htgroup
  563.    AuthName ByPassword
  564.    AuthType Basic
  565.  
  566.    <Limit GET>
  567.    require group my-users
  568.    </Limit>
  569.  
  570.    Note that AuthGroupFile now points to your group file and that group 
  571.    my-users (rather than individual user pumpkin) is now required for
  572.    access. 
  573.  
  574.    That's it. Now any user in group my-users can use his/her individual
  575.    username and password to gain access to directory turkey. 
  576.  
  577.    CERN has extensive documents on http-based authentication. The URL is
  578.    http://info.cern.ch/hypertext/WWW/AccessAuthorization/Overview.html. 
  579.  
  580.  
  581.  
  582.    Graphical Information Map Tutorial
  583.  
  584.    Introduction
  585.  
  586.    This document is a step-by-step tutorial for designing and serving graphical
  587.    maps of information resources. Through such a map, users can be provided
  588.    with a graphical overview of any set of information resources; by clicking on
  589.    different parts of the overview image, they can transparently access any of the
  590.    information resources (possibly spread out all across the Internet). 
  591.  
  592.    First Steps
  593.  
  594.    This tutorial assumes use of NCSA httpd (version 1.0a5 or later). Some other
  595.    servers (e.g. Plexus) can also serve image maps, in server-specific ways; see
  596.    the specific server's docs for more information. 
  597.  
  598.    Make sure you have a working NCSA httpd server installed and running. 
  599.  
  600.    Make sure you have write privileges to the server's 
  601.    conf/imagemap.conf config file. 
  602.  
  603.    Also make sure that the imagemap program is compiled and in the server's 
  604.    htbin directory. 
  605.  
  606.    This tutorial also assumes use of NCSA Mosaic for X version 2.0. Other
  607.    clients that support inlined GIF images and HTTP/1.0 URL redirection will
  608.    also work. 
  609.  
  610.    Your First Image Map
  611.  
  612.    In this section we walk through the steps needed to get an initial image map
  613.    up and running. 
  614.  
  615.    First, create an image. 
  616.  
  617.    There are a number of image creation and editing programs that will work
  618.    nicely -- the one I use is called xpaint (you can find it on ftp.x.org in 
  619.    /R5contrib; The important thing is that the image ends up in GIF
  620.    format. 
  621.  
  622.    A common scheme for an image map is a collection of rectangles and
  623.    circles, each containing a short text description of some piece of
  624.    information or some information server; interconnections are conveyed
  625.    through lines or arcs. Try to keep the individual items in the map spaced
  626.    out far enough so a user will clearly know what he or she is clicking on. 
  627.  
  628.    Second, create an image map file. 
  629.  
  630.    Here is what an image map file looks like: 
  631.  
  632.    default /X11/mosaic/public/none.html
  633.  
  634.    rect http://cui_www.unige.ch/w3catalog    15,8    135,39
  635.    rect gopher://rs5.loc.gov/11/global       245,86  504,143  
  636.    rect http://nearnet.gnn.com/GNN-ORA.html  117,122 175,158 
  637.  
  638.    The format is fairly straightforward. The first line specifies the default
  639.    response (the file to be returned if the region of the image in which the user
  640.    clicks doesn't correspond to anything). 
  641.  
  642.    Subsequent lines specify rectangles in the image that correspond to arbitrary
  643.    URLs -- for the first of these lines, the rectangle specified by 15,8 (x,y of
  644.    the upper-left corner, in pixels) and 135,39 (lower-right corner)
  645.    corresponds to URL http://cui_www.unige.ch/w3catalog. 
  646.  
  647.    So, what you need to do is find the upper-left and lower-right corners of a
  648.    rectangle for each information resource in your image map. A good tool to
  649.    use for this is xv (also on ftp.x.org in /contrib)-- pop up the Info window and
  650.    draw rectangles over the image with the middle mouse button. 
  651.  
  652.    It doesn't matter where you put your map file or what you name it. For the
  653.    purposes of this example, let's assume it's called /foo/sample.map. 
  654.  
  655.    Third, tell your server about your image map file. 
  656.  
  657.    You do this by adding a file to the server's conf/imagemap.conf file.
  658.    The line looks like this: 
  659.  
  660.    sample : /foo/sample.map
  661.  
  662.    ... where sample is the symbolic name for your image map and 
  663.    /foo/sample.map is the actual name of your map file. 
  664.  
  665.    Fourth, create an HTML document that contains your map image. 
  666.  
  667.    An example follows: 
  668.  
  669.    Click on the information resource you wish to see: <P>
  670.  
  671.    <A HREF="http://machine/htbin/imagemap/sample">
  672.    <img src="sample.gif" ismap>
  673.    </A> <P>
  674.  
  675.    Note: 
  676.  
  677.       machine is the name of the machine on which your HTTP server
  678.       resides. 
  679.  
  680.       sample is the symbolic name of your image map (from above). 
  681.  
  682.       sample.gif is the name of your image (assuming, of course, that
  683.       it's in the same directory on your server as the HTML file). 
  684.  
  685.    Fifth, try it out! Load the HTML file, look at the inlined image, click
  686.    somewhere, and see what happens. 
  687.  
  688.    Subsequent Image Maps
  689.  
  690.    You can serve as many image maps from a single server as you want. Just add
  691.    lines to conf/imagemap.conf pointing to each image map file you
  692.    create. 
  693.  
  694.    Real-World Examples
  695.  
  696.    Following are examples of distributed image maps on servers in the real
  697.    world; they may or may not work at any point in time. The URL for them is
  698.    provided. 
  699.  
  700.       Experimental Internet Resources Metamap
  701.       http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Demo/metamap.html
  702.  
  703.       University of California Museum of Paleontology
  704.       http://ucmp1.berkeley.edu/. 
  705.  
  706.       National Institute of Standards and Technology
  707.       http://www.nist.gov/welcome.html 
  708.  
  709.       server map at NCHPC information server
  710.       http://info.lcs.mit.edu/Info/structure.html 
  711.  
  712.  
  713.  
  714.    WAIS and HTTP Integration
  715.  
  716.    Introduction
  717.  
  718.    This document overviews existing methods for using WAIS as a back-end
  719.    search engine for HTTP servers. 
  720.  
  721.    Information herein is currently experimental and may or may not work for
  722.    you. 
  723.  
  724.    WAIS and Plexus
  725.  
  726.    Plexus is a powerful Perl-based HTTP server written and maintained by Tony
  727.    Sanders at BSDI. The URL's you might be interested in are:
  728.    http://www.bsdi.com/server/doc/plexus.html
  729.    http://www.cs.cmu.edu:8001/Web/People/rgs/perl.html
  730.  
  731.    WAIS and GN
  732.  
  733.    GN is a multi-protocol server written and maintained by John Franks at
  734.    NWU. It is shipped with support for WAIS as a back-end search engine. 
  735.  
  736.    The URL's you might be interested in are:
  737.    http://hopf.math.nwu.edu/
  738.    http://hopf.math.nwu.edu:70/0h/docs/waisgn.guide
  739.  
  740.    WAIS and NCSA httpd 1.0
  741.  
  742.    Rob McCool has written a CGI script which allows NCSA httpd 1.0 as well
  743.    as other CGI compliant servers to access a WAIS database in the same way
  744.    that is mentioned in this document. The script is in the CGI archive. It
  745.    contains instructions for setting it up under httpd 1.0. 
  746.  
  747.    The URL's you might be interested in are:
  748.    ftp://ftp.ncsa.uiuc.edu/Web/ncsa_httpd/cgi/wais.tar.Z
  749.  
  750.    freeWAIS 0.202's URL Type
  751.  
  752.    freeWAIS 0.202 is shipped with support for type "URL". Use of this type is a
  753.    little tricky. 
  754.  
  755.    First, Mosaic 2.0 doesn't know how to deal with this type directly, but
  756.    Mosaic 2.1 (when it is released) will. 
  757.  
  758.    Second, use of this type apparently implies overloading the "headline" of a
  759.    WAIS hit with the URL. This is fine, except then the description that the user
  760.    sees of a given document is the URL, and URLs are, as usual, pretty cryptic
  761.    things to just throw in front of average users. 
  762.  
  763.    But anyway, here's how it works: 
  764.  
  765.        waisindex ... -t URL what-to-trim what-to-add ...
  766.  
  767.    So what does that mean? 
  768.  
  769.    Well, first, -t URL tells waisindex to use type URL (note use of 
  770.    lowercase -t in this instance). 
  771.  
  772.    Second, what-to-trim and what-to-add are parameters that tell the
  773.    indexer how to put together the URL that's returned as the result of a query. 
  774.  
  775.    Suppose your documents are normally stored in /X11/mosaic/public.
  776.    Suppose also that these documents are normally served via a URL that begins
  777.    with http://wintermute.ncsa.uiuc.edu:8080. 
  778.  
  779.    This means that a file stored as /X11/mosaic/public/foo.html,
  780.    for example, is normally served as 
  781.    http://wintermute.ncsa.uiuc.edu:8080/foo.html. 
  782.  
  783.    The waisindex command you'd use in this case would be something like
  784.    the following: 
  785.  
  786.        waisindex -d ~/localwais/sources/www -export
  787.          -t URL /X11/mosaic/public http://wintermute.ncsa.uiuc.edu:8080
  788.          /X11/mosaic/public/*.html
  789.  
  790.    ... where ~/localwais/sources/www is the name of the WAIS
  791.    index file and /X11/mosaic/public/*.html are the files you are
  792.    indexing. 
  793.  
  794.    When queries are made on this database, the string 
  795.    /X11/mosaic/public is removed from the beginning of the filename of
  796.    a matching file and the string 
  797.    http://wintermute.ncsa.uiuc.edu:8080 is put in its place. 
  798.  
  799.    As per our previous example: /X11/mosaic/public/foo.html
  800.    turns into 
  801.    http://wintermute.ncsa.uiuc.edu:8080/foo.html as the
  802.    result of a WAIS hit. 
  803.  
  804.    As you can see, this is perfect -- the WAIS server passes back the exact same
  805.    URL that would normally be used to access this file via HTTP. So, everything
  806.    from relative hyperlinks to relative inlined image references in the file will
  807.    work correctly when the file is retrieved. 
  808.  
  809.