# Module mod_cgi

This module is contained in the `mod_cgi.c` file, and is compiled in by default. It provides for execution of CGI scripts. Any file with mime type `application/x-httpd-cgi` will be processed by this module.

## Summary

Any file that has the mime type `application/x-httpd-cgi` will be treated as a CGI script, and run by the server, with its output being returned to the client. Files acquire this type either by having a name ending in an extension defined by the AddType directive, or by being in a ScriptAlias directory.

When the server invokes a CGI script, it will add a variable called `DOCUMENT_ROOT` to the environment. This variable will contain the value of the DocumentRoot configuration variable.

## CGI Environment variables

The server will set the CGI environment variables as described in the CGI specification, with the following provisos:

REMOTE_HOST
  This will only be set if the server has not been compiled with `MINIMAL_DNS`.
REMOTE_IDENT
  This will only be set if IdentityCheck is set to `on`.
REMOTE_USER
  This will only be set if the CGI script is subject to authentication.