Running Web Pages Remotely


This chapter describes

The RCGI Daemon

The RCGI daemon is a UNIX service that communicates with the NetWare® Web Server using the RCGI protocol. You must use the RCGI daemon to run existing CGI scripts and applications from a remote UNIX machine. You do not need to run the RCGI daemon when executing an RCGI application, regardless of whether you are running the application remotely. The RCGI source files you include in your application code perform the same functions as the RCGI daemon.

Click here to see a figure that illustrates the relationship between the NetWare Web Server and a remote UNIX host.The daemon runs on a remote UNIX host and accepts web page requests from the NetWare Web Server.

The RCGI daemon is available as an executable module called rcgid. Versions of rcgid are available for these operating systems.

Installing and Using an RCGI Daemon

To install an RCGI daemon on a remote UNIX machine and then access it daemon from a NetWare Web Server follow these steps.

  1. Edit the SRM.CFG file to configure the server to include rcgid.

    Add a RemoteScriptAlias directive to the SRM.CFG file. For example, to configure a UNIX machine on port 8004, type

     RemoteScriptAlias /rcgid/ unixhost:8004

    When the NetWare Web Server receives a URL with a virtual path of /RCGID/, the request is directed to the UNIX machine (unixhost).

  2. Restart the Web Server.

    To stop and restart the NetWare Web Server so that it recognizes the newly configured rcgid virtual path, type:

    unload http
    load http
  3. Move rcgid to the UNIX machine using a method such as FTP. You can find sample scripts in \WEB\SAMPLES\RCGID\RCGISAMP. You can copy these to the UNIX machine as well.
  4. Invoke rcgid on the UNIX machine.
    1. To specify Read and Execute permissions for rcgid, type
      chmod 555 rcgid
    2. To start the RCGI daemon, type
      rcgid -p portno [-d usrdir] [-n]

      portno specifies the port number for the RCGI daemon. The port number must match the port number specified in the SRM.CFG file. For example:

      rcgid -p 8004

      usrdir identifies the directory where UNIX scripts and files can be found if you choose not to put them in the default location (the directory from which rcgid was loaded). For example, if your scripts are located in /usr/bin, use this command to invoke rcgid:

      rcgid -d /usr/bin

      -n-An HTTP header ends with a blank line. If your script produces a type of output other than ASCII or HTML, then it must produce an HTTP "content-type" header followed by a blank line. The RCGI daemon automatically outputs a header followed by a blank line. Use the optional -n switch to suppress this automatic output of a blank line. For example:

      rcgid -n -p 8004

      If you use the -n switch, your script must include a blank line after the HTTP header(s).

  5. Test the rcgid you have just installed.

    From a Web browser, type a URL that calls a script on the UNIX machine. For example:

    http://www.webserver/rcgid/myscript.pl

    The MYSCRIPT.PL file on the UNIX machine might look like this:

    #!/usr/bin/perl
    Print "Content-type: text /html\n\n";
    Print "<HTML><HEAD><TITLE>Test Script</TITLE></Head></HTML>\n";

    The first line in the myscript.pl file invokes the Perl interpreter on the UNIX machine. The second line prints a content-type field for the HTTP header, with two carriage returns (\n) so that the header is followed by a blank line. The next two lines (and all lines following) are input to the Perl interpreter.