Sun Java System Web Server 7.0 Update 2 Administrator's Guide

Configuring CGI Subsystem for Your Server

Web Server allows you to add CGI document directories using the administration console GUI.

To add a new CGI document directory, perform the following tasks:

  1. Click Configurations tab and select the configuration from the configuration list.

  2. Click Virtual Servers sub tab and select the virtual server from the virtual server list.

  3. Click Content Handling sub tab and CGI sub tab.

  4. Click New button to add a new CGI document directory.

  5. Provide necessary values for fields described in . Click on OK button. You may need to click on Deploy button for the configuration if needed.

The following table describes the fields required while adding a new CGI document directory.

Table 9–2 CGI Parameters

Parameter

Description

Prefix 

Type the URL prefix to use for this directory. That is, the text you type appears as the directory for the CGI programs in URLs.  

For example, if you type cgi-bin as the URL prefix, then all URLs to these CGI programs have the following structure:

http://yourserver.domain.com/cgi-bin/program-name

CGI Directory 

In the CGI Directory text field, type the location of the directory as an absolute path. Note that this directory doesn’t have to be under your document root. This is the reason that you need to specify a URL prefix. 


Note –

The URL prefix you specify can be different from the real CGI directory.


User 

Specify the name of the user to execute CGI programs as. 

Group 

Specify the name of the group to execute the CGI programs as. 

Chroot 

Specify the directory to chroot to before execution begins. 

Nice 

Specify a nice value, an increment that determines the CGI program's priority relative to the server. 

Typically, the server is run with a nice value of 0 and the nice increment would be between 0 (the CGI program runs at same priority as server) and 19 (the CGI program runs at much lower priority than server). While it is possible to increase the priority of the CGI program above that of the server by specifying a nice increment of -1, this is not recommended. 

To remove an existing CGI directory, select the CGI directory and click Delete button. To change the URL prefix or CGI directory of an existing directory, click on the directory link.

Copy your CGI programs into the directories you’ve specified. Remember that any files in those directories will be processed as CGI files, so do not put HTML files in your CGI directory.

For specifying CGI as a file type, perform the following tasks:

  1. Click Configurations tab and select the configuration from the configuration list.

  2. Click Virtual Servers sub tab and select the virtual server from the virtual server list.

  3. Click Content Handling sub tab and CGI sub tab.

  4. Click CGI as file type radio box enable.

The CGI files must have the file extensions .bat, .exe, or .cgi. Any non-CGI files with those extensions are processed by your server as CGI files, causing errors.


Note –

Using CLI

You can create a CGI directory that contains the CGI programs that will be processed by your server. CGI programs are in a certain file type such as .cgi, .exe, or .bat. The programs can be located in any directory in or under the document root directory.

To add a CGI directory through CLI execute the following command.


wadm> create-cgi-dir --user=admin --password-file=admin.pwd --host=serverhost 
--port=8989 --config=config1 --vs=config1_vs_1 --uri-prefix=/config1_urlprefix 
--directory=/cgi-dir

See CLI Reference, create-cgi-dir(1).