Apache HTTP Server Version 2.4
Related Modules | Related Directives |
---|---|
The CGI (Common Gateway Interface) defines a way for a web server to interact with external content-generating programs, which are often referred to as CGI programs or CGI scripts. It is a simple way to put dynamic content on your web site, using whatever programming language you're most familiar with. This document will be an introduction to setting up CGI on your Apache web server, and getting started writing CGI programs.
In order to get your CGI programs to work properly, you'll need to have Apache configured to permit CGI execution. There are several ways to do this.
httpd.conf
you need to make sure the
LoadModule
directive has not been commented out. A correctly configured directive
may look like this:
LoadModule cgid_module modules/mod_cgid.soOn Windows, or using a non-threaded MPM like prefork, A correctly configured directive may look like this:
LoadModule cgi_module modules/mod_cgi.so
The
ScriptAlias
directive tells Apache that a particular directory is set
aside for CGI programs. Apache will assume that every file in
this directory is a CGI program, and will attempt to execute
it, when that particular resource is requested by a
client.
The ScriptAlias
directive looks like:
ScriptAlias "/cgi-bin/" "/usr/local/apache2/cgi-bin/"
The example shown is from your default httpd.conf
configuration file, if you installed Apache in the default
location. The