|
|
||
Getting Started with CGISince you are reading this section, it is presumed that you already know what CGI processing is. If not, a good introduction can be found here. Yahoo! has a good index of CGI references.Getting started with CGI can seem to be a daunting task. Many of the posts to comp.infosystems.www.servers.unix contain requests for help to get CGI working. Like all types of network programming, it is necessary to get more than one thing running correctly before you see any results, but it's not difficult, others have done it before, and after setting the configuration options in this section, your server should be configured to process CGI requests. Note: Through out this document, I refer to CGI scripts. This is only a convention. CGI programs can be written in virtually any language you are conversant with. The can be compiled or interpreted or a mixture of both. The choice is yours. This guide will not help you write CGI scripts, but will help you get them to run, and help you to debug them is they don't. If you don't know how to program, you are going to have to learn, or find someone who will do the programming for you!. Minimum ConfigurationApache provides a number of configuration options relating to CGIs. There are two main options for CGIs and Apache:
Many Linux distributions now have cgi-bin enabled in the default configuration. CGI LocationThe ScriptAlias option allows you to group all you CGI scripts into a single directory. Any files found in this directory will be treated by Apache as CGI scripts.
I have a personal dislike for the default location of the cgi-bin directory for Apache 2.x under the Ubuntu distribution. For some reason it is located in: To specify a directory where you cgi scripts will reside, edit srm.conf and change | |||
| |||
| To: (just remove the '#' comment character) | |||
| |||
| Here we have specified that files found in the directory /apache/cgi-bin/ should be treated as CGI scripts. NT users would specify: | |||
| |||
|
Note: in both the Unix and NT examples, we have specified an absolute path from the
root of the file system.
CGI scripts, in the above example would be referenced by the url: <a href="http://your.host.name/cgi-bin/your_script_name"> or <a href="/cgi-bin/your_script_name">Once you have decided where you CGI directory will be located, edit access.conf and change the following to conform with the ScriptAliases changes. | |||
| |||
Re-start your Apache web server and then proceed to
test your CGI configuration.
ReferencesGeneralApache Directives |
|||